1 | # $Id: pdwin32.wat.post,v 1.3 2000-09-28 03:16:24 bird Exp $
|
---|
2 | #
|
---|
3 | # Odin32 API
|
---|
4 | #
|
---|
5 | # Common dll makefile rules (must be included at the last line of the makefile)
|
---|
6 | #
|
---|
7 | # If ORGTARGET is defined it is used to generate the importlibrary.
|
---|
8 | #
|
---|
9 | # Define NOTEXPDEF to remove the $(TARGET).lib and $(TARGET)exp.def rules.
|
---|
10 | # Define EXETARGET to make an executable. (This also applies to pdwin32.mk.)
|
---|
11 | # Define LOCALCLEAN if only the local directory is to be clean.
|
---|
12 | # Define CLEAN2 to invoke a second clean rule named 'clean2'.
|
---|
13 | # Define NOCLEAN to exclude the clean rule. (Remember to make your own!)
|
---|
14 | #
|
---|
15 | # New style: (define NEW_STYLE)
|
---|
16 | # Define NO_ALL_RULE to not make default all rule.
|
---|
17 | # Define NO_LIB_RULE to not make default lib rule.
|
---|
18 | # Define NO_DLL_RULE to not make default dll rule.
|
---|
19 | # Define NO_EXE_RULE to not make default exe rule.
|
---|
20 | # Define NO_LNKFILE_RULE to not make default link-file rule.
|
---|
21 | # Define NO_DEP_RULE to not make dependencies rule.
|
---|
22 | # Define NO_CLEAN_RULE to not make clean rule (same as NOCLEAN - use this!).
|
---|
23 | #
|
---|
24 |
|
---|
25 |
|
---|
26 | !ifdef NEW_STYLE
|
---|
27 | !ifndef EXETARGET
|
---|
28 |
|
---|
29 |
|
---|
30 | # All rule - build objs, target dll, copies target to bin and makes libs.
|
---|
31 | !ifndef NO_ALL_RULE
|
---|
32 | all: $(OBJDIR) \
|
---|
33 | $(OBJDIR)\$(TARGET).dll \
|
---|
34 | $(PDWIN32_BIN)\$(TARGET).dll \
|
---|
35 | lib
|
---|
36 | !endif
|
---|
37 |
|
---|
38 |
|
---|
39 | # Lib rule - build importlibrary (and evt. other libs)
|
---|
40 | !ifndef NO_LIB_RULE
|
---|
41 | lib: $(TARGET).lib $(PDWIN32_LIB)\$(TARGET).lib
|
---|
42 | !endif
|
---|
43 |
|
---|
44 |
|
---|
45 | # Dll rule - builds the target dll.
|
---|
46 | !ifndef NO_DLL_RULE
|
---|
47 | $(OBJDIR)\$(TARGET).dll: $(OBJS) $(TARGET).def $(OBJDIR)\$(TARGET).lrf
|
---|
48 | $(LD2) @$(OBJDIR)\$(TARGET).lrf
|
---|
49 | !endif
|
---|
50 |
|
---|
51 |
|
---|
52 | # Linker file - creates the parameter file passed on to the linker.
|
---|
53 | !ifndef NO_LNKFILE_RULE
|
---|
54 | $(OBJDIR)\$(TARGET).lrf: makefile $(PDWIN32_INCLUDE)\pdwin32.wat.post
|
---|
55 | @$(RM) $@
|
---|
56 | @echo Creating file <<$@
|
---|
57 | $(LD2FLAGS)
|
---|
58 | name $(OBJDIR)\$(TARGET).dll
|
---|
59 | option map=$(OBJDIR)\$(TARGET).map
|
---|
60 | file {$(OBJS)}
|
---|
61 | library {$(LIBS)}
|
---|
62 | <<keep
|
---|
63 | # $(TARGET).def
|
---|
64 | # $(TARGET).map
|
---|
65 | !endif
|
---|
66 |
|
---|
67 |
|
---|
68 | # Dep rule - makes depenencies for C, C++ and Asm files.
|
---|
69 | !ifndef NO_DEP_RULE
|
---|
70 | dep:
|
---|
71 | $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win \
|
---|
72 | *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h
|
---|
73 | !endif
|
---|
74 |
|
---|
75 | !else # !ifndef EXETARGET
|
---|
76 |
|
---|
77 |
|
---|
78 | # All rule - build objs, target exe, copies target to bin.
|
---|
79 | !ifndef NO_ALL_RULE
|
---|
80 | all: $(OBJDIR) \
|
---|
81 | $(OBJDIR)\$(TARGET).exe \
|
---|
82 | $(PDWIN32_BIN)\$(TARGET).exe
|
---|
83 | !endif
|
---|
84 |
|
---|
85 |
|
---|
86 | # Lib rule - dummy rule
|
---|
87 | !ifndef NO_LIB_RULE
|
---|
88 | lib:
|
---|
89 | !endif
|
---|
90 |
|
---|
91 |
|
---|
92 | # Exe rule - builds the target exe.
|
---|
93 | !ifndef NO_EXE_RULE
|
---|
94 | $(OBJDIR)\$(TARGET).exe: $(OBJSNOOBJDIR) $(TARGET).def $(OBJDIR)\$(TARGET).lrf
|
---|
95 | $(LD2) $(LD2FLAGS) @$(OBJDIR)\$(TARGET).lrf
|
---|
96 | !endif
|
---|
97 |
|
---|
98 |
|
---|
99 | # Linker file - creates the parameter file passed on to the linker.
|
---|
100 | !ifndef NO_LNKFILE_RULE
|
---|
101 | $(OBJDIR)\$(TARGET).lrf: makefile $(PDWIN32_INCLUDE)\pdwin32.wat.post
|
---|
102 | @echo Creating file <<$@
|
---|
103 | /OUT:$(OBJDIR)\$(TARGET).exe
|
---|
104 | /MAP:$(OBJDIR)\$(TARGET).map
|
---|
105 | $(OBJS)
|
---|
106 | $(LIBS)
|
---|
107 | $(TARGET).def
|
---|
108 | <<keep
|
---|
109 | !endif
|
---|
110 |
|
---|
111 |
|
---|
112 | # Dep rule - makes depenencies for C, C++ and Asm files.
|
---|
113 | !ifndef NO_DE_PRULE
|
---|
114 | dep:
|
---|
115 | $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win \
|
---|
116 | *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h
|
---|
117 | !endif
|
---|
118 |
|
---|
119 |
|
---|
120 | !endif # EXETARGET
|
---|
121 | !endif # NEW_STYLE
|
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|
126 | # Copy library rule.
|
---|
127 | !ifndef ORGTARGET
|
---|
128 | $(PDWIN32_LIB)\$(TARGET).lib: $(TARGET).lib
|
---|
129 | !else
|
---|
130 | $(PDWIN32_LIB)\$(ORGTARGET).lib: $(ORGTARGET).lib
|
---|
131 | !endif
|
---|
132 | $(CP) $** $@
|
---|
133 |
|
---|
134 |
|
---|
135 | # Copy dll rule.
|
---|
136 | !ifndef EXETARGET
|
---|
137 | $(PDWIN32_BIN)\$(TARGET).dll: $(OBJDIR)\$(TARGET).dll
|
---|
138 | !else
|
---|
139 | $(PDWIN32_BIN)\$(TARGET).exe: $(OBJDIR)\$(TARGET).exe
|
---|
140 | !endif
|
---|
141 | cd $(OBJDIR)
|
---|
142 | $(MAPSYM) $(TARGET).map
|
---|
143 | cd ..\..
|
---|
144 | $(CP) $(OBJDIR)\$(TARGET).sym $(PDWIN32_BIN)
|
---|
145 | $(CP) $** $@
|
---|
146 | -$(CP) $** $(@D)..\..\$(@F)
|
---|
147 | -$(CP) $(OBJDIR)\$(TARGET).sym $(@D)..\..
|
---|
148 |
|
---|
149 |
|
---|
150 | !ifndef NOTEXPDEF
|
---|
151 | # make library from the <>exp.def file.
|
---|
152 | !ifndef ORGTARGET
|
---|
153 | $(TARGET).LIB: $(TARGET)exp.def
|
---|
154 | !else
|
---|
155 | $(ORGTARGET).LIB: $(ORGTARGET)exp.def
|
---|
156 | !endif
|
---|
157 | $(IMPLIB) $(IMPLIBFLAGS) $@ $**
|
---|
158 | $(CP) $@ $(PDWIN32_LIB)
|
---|
159 |
|
---|
160 |
|
---|
161 | # make the <>exp.def file.
|
---|
162 | !ifndef ORGTARGET
|
---|
163 | $(TARGET)exp.def: $(TARGET).def
|
---|
164 | !else
|
---|
165 | $(ORGTARGET)exp.def: $(ORGTARGET).def
|
---|
166 | !endif
|
---|
167 | $(IMPDEF) $** $@
|
---|
168 | !endif
|
---|
169 |
|
---|
170 |
|
---|
171 | # Create the object directory.
|
---|
172 | $(OBJDIR): .SYMBOLIC
|
---|
173 | @if not exist bin $(MKDIR) bin
|
---|
174 | @if not exist $(OBJDIR) $(MKDIR) $(OBJDIR)
|
---|
175 |
|
---|
176 |
|
---|
177 | #
|
---|
178 | # General clean rule. To clean more add it to CLEANEXTRAS!
|
---|
179 | #
|
---|
180 | !ifndef NOCLEAN
|
---|
181 | !ifndef NO_CLEAN_RULE
|
---|
182 | !ifndef CLEAN2
|
---|
183 | clean: .SYMBOLIC
|
---|
184 | !else
|
---|
185 | clean: clean2
|
---|
186 | !endif
|
---|
187 | $(RM) *.LIB *.res *.map *.pch *.orc_asm \
|
---|
188 | !if "$(OBJDIR)" != ""
|
---|
189 | $(OBJDIR)\* \
|
---|
190 | !endif
|
---|
191 | !ifndef LOCALCLEAN
|
---|
192 | $(PDWIN32_LIB)\$(TARGET).LIB \
|
---|
193 | !ifndef EXETARGET
|
---|
194 | $(PDWIN32_BIN)\$(TARGET).dll $(TARGET)exp.def *.dll \
|
---|
195 | !else
|
---|
196 | $(PDWIN32_BIN)\$(TARGET).exe *.exe \
|
---|
197 | !endif
|
---|
198 | $(CLEANEXTRAS)
|
---|
199 | !else
|
---|
200 | $(CLEANEXTRAS)
|
---|
201 | !endif
|
---|
202 | !endif
|
---|
203 | !endif
|
---|
204 |
|
---|
205 |
|
---|