1 | # $Id: pdwin32.wat.post,v 1.8 2000-11-21 04:39:20 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 LIBTARGET to make an internal library.
|
---|
12 | # Define LOCALCLEAN if only the local directory is to be clean.
|
---|
13 | # Define CLEAN2 to invoke a second clean rule named 'clean2'.
|
---|
14 | # Define NOCLEAN to exclude the clean rule. (Remember to make your own!)
|
---|
15 | #
|
---|
16 | # New style: (!defined OLD_STYLE)
|
---|
17 | # Define NO_ALL_RULE to not make default all rule.
|
---|
18 | # Define NO_LIB_RULE to not make default lib rule.
|
---|
19 | # Define NO_MAIN_RULE to not make default main target 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 | # Define NO_INTERNAL_LIBS to not include libs rule for subdirectories.
|
---|
24 | # Define NO_MAIN_BIN_COPY to not copy the target and sym file to the main
|
---|
25 | # binary directory. It is only copied to the compiler specific directory.
|
---|
26 | # Main bin is /bin. Compiler specific bin is /bin/debug, /bin/debug.vac36, etc.
|
---|
27 | # Define ADDITIONAL_DEP to add dependencies rules.
|
---|
28 | #
|
---|
29 | # Define MAKEFILE if the name of the makefile isn't "makefile".
|
---|
30 | # Define DEFFILE to specify another file than $(TARGET).def or $(ORGTARGET).def.
|
---|
31 | # Define this if your .exe file have a .def file.
|
---|
32 | # Define OS2RES as the names of the OS/2 .res file to create and link
|
---|
33 | # with the target .dll or .exe.
|
---|
34 | # Define LIBS as a list of all the libraries to link
|
---|
35 | # with the target .dll or .exe.
|
---|
36 | # Define SUBDIRS when you have subdirectories which should be made.
|
---|
37 | # dep and lib supports this fully. The rule libs are added, since we assume you
|
---|
38 | # makes internal libraries in the subdirectories. The libs rule is one of the
|
---|
39 | # dependencies of the main target.
|
---|
40 | #
|
---|
41 |
|
---|
42 |
|
---|
43 | !ifndef TARGET_EXTENSION
|
---|
44 | ! ifdef LIBTARGET
|
---|
45 | TARGET_EXTENSION=lib
|
---|
46 | ! else
|
---|
47 | ! ifdef EXETARGET
|
---|
48 | TARGET_EXTENSION=exe
|
---|
49 | ! else
|
---|
50 | TARGET_EXTENSION=dll
|
---|
51 | ! endif
|
---|
52 | ! endif
|
---|
53 | !endif
|
---|
54 |
|
---|
55 |
|
---|
56 | !ifndef OLD_STYLE
|
---|
57 |
|
---|
58 | # Set default MAKEFILE if needed
|
---|
59 | !ifndef MAKEFILE
|
---|
60 | MAKEFILE = makefile
|
---|
61 | !endif
|
---|
62 |
|
---|
63 | # Set default ORGTARGET if needed.
|
---|
64 | !ifndef ORGTARGET
|
---|
65 | ORGTARGET=$(TARGET)
|
---|
66 | !endif
|
---|
67 |
|
---|
68 | # Set default DEFFILE if needed. (Currently for dlls only.)
|
---|
69 | !ifndef DEFFILE
|
---|
70 | ! ifndef EXETARGET
|
---|
71 | DEFFILE = $(ORGTARGET).def
|
---|
72 | ! endif
|
---|
73 | !endif
|
---|
74 |
|
---|
75 | # Set INTLIBS (interal) if SUBDIRS is defined and NO_INTERNAL_LIBS is undefined.
|
---|
76 | !ifdef SUBDIRS
|
---|
77 | ! ifndef NO_INTERNAL_LIBS
|
---|
78 | ! ifndef LIBTARGET
|
---|
79 | INTLIBS = libs
|
---|
80 | ! else
|
---|
81 | INTLIBS = libs_sub
|
---|
82 | ! endif
|
---|
83 | ! endif
|
---|
84 | !endif
|
---|
85 |
|
---|
86 |
|
---|
87 | !ifndef LIBTARGET
|
---|
88 | !ifndef EXETARGET
|
---|
89 | ###############################################################################
|
---|
90 | # DLL Target
|
---|
91 | ###############################################################################
|
---|
92 |
|
---|
93 | #
|
---|
94 | # Dll: All rule - build objs, target dll, copies target to bin and makes libs.
|
---|
95 | #
|
---|
96 | !ifndef NO_ALL_RULE
|
---|
97 | all: $(OBJDIR) \
|
---|
98 | $(INTLIBS) \
|
---|
99 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
100 | $(OBJDIR)\$(TARGET).sym \
|
---|
101 | $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
102 | $(PDWIN32_BIN)\$(TARGET).sym \
|
---|
103 | lib \
|
---|
104 | .SYMBOLIC
|
---|
105 | !endif
|
---|
106 |
|
---|
107 | #
|
---|
108 | # Dll: Lib rule - build importlibrary (and evt. other libs)
|
---|
109 | #
|
---|
110 | !ifndef NO_LIB_RULE
|
---|
111 | lib: $(ORGTARGET).lib $(PDWIN32_LIB)\$(ORGTARGET).lib
|
---|
112 | !endif
|
---|
113 |
|
---|
114 |
|
---|
115 | #
|
---|
116 | # Dll: Main target rule - builds the target dll.
|
---|
117 | #
|
---|
118 | !ifndef NO_MAIN_RULE
|
---|
119 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(OBJS) $(OS2RES) $(DEFFILE) $(OBJDIR)\$(TARGET).lrf
|
---|
120 | $(LD2) @$(OBJDIR)\$(TARGET).lrf
|
---|
121 | !ifdef OS2RES
|
---|
122 | $(OS2RC) $(OS2RCLFLAGS) $(OS2RES) $@
|
---|
123 | !endif
|
---|
124 | !endif
|
---|
125 |
|
---|
126 |
|
---|
127 | #
|
---|
128 | # Dll: Linker file - creates the parameter file passed on to the linker.
|
---|
129 | #
|
---|
130 | !ifndef NO_LNKFILE_RULE
|
---|
131 | $(OBJDIR)\$(TARGET).lrf: makefile $(DEFFILE) $(PDWIN32_INCLUDE)\pdwin32.wat.post
|
---|
132 | $(RM) $(OBJDIR)\$(TARGET).lrf2 $@
|
---|
133 | $(KDEF2WAT) $(DEFFILE) $@ <<$(OBJDIR)\$(TARGET).lrf2
|
---|
134 | $(LD2FLAGS)
|
---|
135 | name $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
|
---|
136 | option map=$(OBJDIR)\$(TARGET).map
|
---|
137 | file {$(OBJS)}
|
---|
138 | library {$(LIBS)}
|
---|
139 | <<
|
---|
140 | !endif
|
---|
141 |
|
---|
142 |
|
---|
143 | !else # !ifndef EXETARGET
|
---|
144 | ###############################################################################
|
---|
145 | # EXE Target
|
---|
146 | ###############################################################################
|
---|
147 |
|
---|
148 | #
|
---|
149 | # Exe: All rule - build objs, target exe, copies target to bin.
|
---|
150 | #
|
---|
151 | !ifndef NO_ALL_RULE
|
---|
152 | all: $(OBJDIR) \
|
---|
153 | $(INTLIBS) \
|
---|
154 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
155 | $(OBJDIR)\$(TARGET).sym \
|
---|
156 | $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
157 | $(PDWIN32_BIN)\$(TARGET).sym \
|
---|
158 | .SYMBOLIC
|
---|
159 | !endif
|
---|
160 |
|
---|
161 | #
|
---|
162 | # Exe: Lib rule - dummy rule
|
---|
163 | #
|
---|
164 | !ifndef NO_LIB_RULE
|
---|
165 | lib: .SYMBOLIC
|
---|
166 | !endif
|
---|
167 |
|
---|
168 |
|
---|
169 | #
|
---|
170 | # Exe: Main target rule - builds the target exe.
|
---|
171 | #
|
---|
172 | !ifndef NO_MAIN_RULE
|
---|
173 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(OBJS) $(OS2RES) $(DEFFILE) $(OBJDIR)\$(TARGET).lrf
|
---|
174 | $(LD2) @$(OBJDIR)\$(TARGET).lrf
|
---|
175 | !ifdef OS2RES
|
---|
176 | $(OS2RC) $(OS2RCLFLAGS) $(OS2RES) $@
|
---|
177 | !endif
|
---|
178 | !endif
|
---|
179 |
|
---|
180 |
|
---|
181 | #
|
---|
182 | # Exe: Linker file - creates the parameter file passed on to the linker.
|
---|
183 | #
|
---|
184 | !ifndef NO_LNKFILE_RULE
|
---|
185 | $(OBJDIR)\$(TARGET).lrf: makefile $(PDWIN32_INCLUDE)\pdwin32.wat.post $(DEFFILE)
|
---|
186 | $(RM) $(OBJDIR)\$(TARGET).lrf2 $@
|
---|
187 | !ifdef DEFFILE
|
---|
188 | $(KDEF2WAT) $(DEFFILE) $@ <<$(OBJDIR)\$(TARGET).lrf2
|
---|
189 | !else
|
---|
190 | $(ECHO) Creating <<$@
|
---|
191 | !endif
|
---|
192 | $(LD2FLAGS)
|
---|
193 | name $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
|
---|
194 | option map=$(OBJDIR)\$(TARGET).map
|
---|
195 | file {$(OBJS)}
|
---|
196 | library {$(LIBS)}
|
---|
197 | <<
|
---|
198 | !endif
|
---|
199 |
|
---|
200 | !endif # !ifndef EXETARGET !else
|
---|
201 | !else # !ifndef LIBTARGET
|
---|
202 | ###############################################################################
|
---|
203 | # LIB target (internal object library)
|
---|
204 | ###############################################################################
|
---|
205 |
|
---|
206 | #
|
---|
207 | # Localcleanup is default for internal object libraries.
|
---|
208 | #
|
---|
209 | LOCALCLEAN = 1
|
---|
210 |
|
---|
211 |
|
---|
212 | #
|
---|
213 | # Lib: All rule - build objs and target library.
|
---|
214 | #
|
---|
215 | !ifndef NO_ALL_RULE
|
---|
216 | all: $(OBJDIR) \
|
---|
217 | $(INTLIBS) \
|
---|
218 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION) \
|
---|
219 | .SYMBOLIC
|
---|
220 | !endif
|
---|
221 |
|
---|
222 |
|
---|
223 | #
|
---|
224 | # Lib: Lib rule - dummy rule
|
---|
225 | #
|
---|
226 | !ifndef NO_LIB_RULE
|
---|
227 | lib: .SYMBOLIC
|
---|
228 | !endif
|
---|
229 |
|
---|
230 |
|
---|
231 | #
|
---|
232 | # Lib: Internal library rule. Same as the all rule.
|
---|
233 | #
|
---|
234 | !ifndef NO_INTERNAL_LIBS
|
---|
235 | libs: all .SYMBOLIC
|
---|
236 | !endif
|
---|
237 |
|
---|
238 |
|
---|
239 | #
|
---|
240 | # Lib: Main target rule - builds the target internal library.
|
---|
241 | # (fixme)
|
---|
242 | !ifndef NO_MAIN_RULE
|
---|
243 | $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION): $(OBJS)
|
---|
244 | $(RM) $@
|
---|
245 | $(ILIB) $(ILIBFLAGS) $@ @<<
|
---|
246 | $(OBJS: =&^
|
---|
247 | )
|
---|
248 | $(OBJDIR)\$^&.lst
|
---|
249 | <<
|
---|
250 | !endif
|
---|
251 |
|
---|
252 |
|
---|
253 | !endif # !ifndef LIBTARGET
|
---|
254 |
|
---|
255 |
|
---|
256 | ###############################################################################
|
---|
257 | # Common rules for both exe and dll, new style
|
---|
258 | ###############################################################################
|
---|
259 |
|
---|
260 | #
|
---|
261 | # Common (new): Dep rule - makes depenencies for C, C++ and Asm files.
|
---|
262 | #
|
---|
263 | !ifndef NO_DEP_RULE
|
---|
264 | dep: dep_internal $(ADDITIONAL_DEP) .SYMBOLIC
|
---|
265 | dep_internal: .SYMBOLIC
|
---|
266 | $(DEPEND) $(CINCLUDES) *.c *.cpp *.h *.asm *.inc \
|
---|
267 | *.rc *.dlg $(PDWIN32_INCLUDE)\*.h -robj *.orc
|
---|
268 | !ifdef SUBDIRS
|
---|
269 | $(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) dep
|
---|
270 | !endif
|
---|
271 | !endif
|
---|
272 |
|
---|
273 |
|
---|
274 | #
|
---|
275 | # Common: Internal library rule. Make libraries in subdirectories.
|
---|
276 | # For makefiles with subdirectories is common to have make libraries in subdirectories.
|
---|
277 | #
|
---|
278 | !ifndef NO_INTERNAL_LIBS
|
---|
279 | !ifdef INTLIBS
|
---|
280 | $(INTLIBS): .SYMBOLIC
|
---|
281 | $(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) libs
|
---|
282 | !endif
|
---|
283 | !endif
|
---|
284 |
|
---|
285 | !endif # OLD_STYLE
|
---|
286 |
|
---|
287 | ###############################################################################
|
---|
288 | # Common rules for both exe and dll, old and new style.
|
---|
289 | ###############################################################################
|
---|
290 |
|
---|
291 | #
|
---|
292 | # Common: Copy library rule.
|
---|
293 | #
|
---|
294 | $(PDWIN32_LIB)\$(ORGTARGET).lib: $(ORGTARGET).lib
|
---|
295 | @if not exist $^: $(CREATEPATH) $^:
|
---|
296 | $(CP) $[@ $@
|
---|
297 |
|
---|
298 |
|
---|
299 | #
|
---|
300 | # Common: Copy dll/exe rule.
|
---|
301 | #
|
---|
302 | $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION): $(OBJDIR)\$(TARGET).$(TARGET_EXTENSION)
|
---|
303 | @if not exist $^: $(CREATEPATH) $^:
|
---|
304 | $(CP) $[@ $^@
|
---|
305 | !ifndef NO_MAIN_BIN_COPY
|
---|
306 | -$(CP) $[@ $^:..\..\$^.
|
---|
307 | !endif
|
---|
308 |
|
---|
309 |
|
---|
310 | #
|
---|
311 | # Common: Copy sym rule.
|
---|
312 | #
|
---|
313 | $(PDWIN32_BIN)\$(TARGET).sym: $(OBJDIR)\$(TARGET).sym
|
---|
314 | @if not exist $^: $(CREATEPATH) $^:
|
---|
315 | $(CP) $[@ $@
|
---|
316 | !ifndef NO_MAIN_BIN_COPY
|
---|
317 | -$(CP) $[@ $^:..\..\$^.
|
---|
318 | !endif
|
---|
319 |
|
---|
320 |
|
---|
321 | #
|
---|
322 | # Common: Make sym file rule.
|
---|
323 | #
|
---|
324 | $(OBJDIR)\$(TARGET).sym: $(OBJDIR)\$(TARGET).map
|
---|
325 | cd $(OBJDIR)
|
---|
326 | $(MAPSYM) $(TARGET).map
|
---|
327 | cd ..\..
|
---|
328 |
|
---|
329 |
|
---|
330 | #
|
---|
331 | # Common: Make library from the <>exp.def or the <>.def file.
|
---|
332 | #
|
---|
333 | !ifndef NOTEXPDEF
|
---|
334 | $(ORGTARGET).lib: $(ORGTARGET)exp.def
|
---|
335 | $(IMPLIB) $(IMPLIBFLAGS) $@ $[@
|
---|
336 | !else
|
---|
337 | $(TARGET).lib: $(DEFFILE)
|
---|
338 | $(IMPLIB) $(IMPLIBFLAGS) $@ $[@
|
---|
339 | !endif
|
---|
340 |
|
---|
341 |
|
---|
342 | #
|
---|
343 | # Common: Make the <>exp.def file.
|
---|
344 | #
|
---|
345 | !ifndef NOTEXPDEF
|
---|
346 | $(ORGTARGET)exp.def: $(DEFFILE)
|
---|
347 | $(IMPDEF) $[@ $@
|
---|
348 | !endif
|
---|
349 |
|
---|
350 |
|
---|
351 | #
|
---|
352 | # Common: Create the object directory.
|
---|
353 | #
|
---|
354 | $(OBJDIR): .SYMBOLIC
|
---|
355 | @if not exist $(OBJDIR) $(CREATEPATH) $(OBJDIR)
|
---|
356 |
|
---|
357 |
|
---|
358 | #
|
---|
359 | # Common: General clean rule. To clean more add it to CLEANEXTRAS!
|
---|
360 | #
|
---|
361 | !ifndef NOCLEAN
|
---|
362 | !ifndef CLEAN2
|
---|
363 | clean: .SYMBOLIC
|
---|
364 | !else
|
---|
365 | clean: clean2 .SYMBOLIC
|
---|
366 | !endif
|
---|
367 | $(RM) *.lib *.res *.map *.pch \
|
---|
368 | !if "$(OBJDIR)" != ""
|
---|
369 | $(OBJDIR)\* \
|
---|
370 | !endif
|
---|
371 | !ifndef LOCALCLEAN
|
---|
372 | $(PDWIN32_LIB)\$(ORGTARGET).lib \
|
---|
373 | $(ORGTARGET)exp.def \
|
---|
374 | $(PDWIN32_BIN)\$(TARGET).$(TARGET_EXTENSION) *.$(TARGET_EXTENSION) \
|
---|
375 | $(PDWIN32_BIN)\$(TARGET).sym *.sym \
|
---|
376 | $(CLEANEXTRAS)
|
---|
377 | !else
|
---|
378 | $(CLEANEXTRAS)
|
---|
379 | !endif
|
---|
380 | !endif
|
---|
381 | !ifdef SUBDIRS
|
---|
382 | $(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) clean
|
---|
383 | !endif
|
---|
384 |
|
---|
385 |
|
---|
386 | #
|
---|
387 | # Common: Include the .depend file.
|
---|
388 | # If the depend file don't exists we'll complain about it.
|
---|
389 | #
|
---|
390 | #!ifndef NODEP
|
---|
391 | #! if [$(EXISTS) .depend] == 0
|
---|
392 | #! include .depend
|
---|
393 | #! else
|
---|
394 | #! if [$(ECHO) .depend doesn't exist]
|
---|
395 | #! endif
|
---|
396 | #! endif
|
---|
397 | #!endif
|
---|
398 |
|
---|