|
|
1.1 root 1: # Makefile : Builds a Foundation class library variant.
2: #
3: # Usage: NMAKE CLEAN (removes all intermediary files)
4: # or: NMAKE options (builds one library variant (see below))
5: # Note that an NMAKE CLEAN should be performed before building a new variant.
6: #
7: # 'Options' are one of each of:
8: # "MODEL=M" (defaults to M)
9: # Any of the following models are accepted: S (small), M (medium),
10: # C (compact), or L (large).
11: # "TARGET=N" (defaults to N)
12: # Any of the following platforms are accepted: R (real-mode DOS),
13: # W (windows), N (Windows NT).
14: # "DLL" (defaults to 0)
15: # If this item is 1, a DLL version of the library is generated.
16: # If this item is 0, then a normal library is generated.
17: # Only Large model versions of DLLs are supported.
18: # "DEBUG" (defaults to 1)
19: # If this item is 1, debugging support is compiled into
20: # the library. If this item is 0, then debugging support
21: # is disabled. Debug support does not include CodeView information.
22: # "CODEVIEW=0" (defaults to 2, always)
23: # If this item is 1 CodeView information is compiled into
24: # the library. You must use the /CODEVIEW link option
25: # in addition, when linking your executable. If this item
26: # is 2, then only selected modules will be compiled with
27: # CodeView information. You must use the link option /CODEVIEW.
28: # A value of 0 indicates that no CodeView information is to be
29: # generated.
30: # "OBJ=.\obj" (defaults to '$$(MODEL)$(TARGET)$(DEBUG)'
31: # This optional specification specifies where temporary OBJ files
32: # are stored during the build process. The directory is created or
33: # removed as necessary.
34: # "OPT=" (no default value)
35: # This allows additional compiler options to be added to the build.
36: # If more than one switch is desired, put double-quotes around the
37: # whole OPT= argument, e.g., "OPT=/J /W3".
38: # "NO_PCH=1"
39: # Set this item to override the default use of precompiled headers
40: #
41: # The default is to build MODEL=M TARGET=W DEBUG=1
42: #
43: #
44: #############################################################################
45: # Standard tools
46:
47: !if "$(MODEL)"=="n" || "$(MODEL)"=="N"
48: CPP=cl386
49: CC=cl386
50: MKNT=1
51: !else
52: CPP=cl
53: CC=cl
54: !endif
55:
56: #############################################################################
57: # Parse these options:
58:
59: !ifndef DEBUG
60: DEBUG=1
61: !endif
62:
63: !ifndef DLL
64: DLL=0
65: !else
1.1.1.2 ! root 66: !ifndef MKNT
! 67: # DLL must be large model, except under Windows/NT.
1.1 root 68: MODEL=l
69: !endif
1.1.1.2 ! root 70: !endif
1.1 root 71:
72: !ifndef TARGET
73: TARGET=W
74: !endif
75:
76: !ifndef MODEL
77: MODEL=M
78: !endif
79:
80: !ifndef CODEVIEW
81: CODEVIEW=2
82: !endif
83:
1.1.1.2 ! root 84: !if "$(CODEVIEW)" == "2"
! 85: #REVIEW_NT: Bug in compiler prevents PCH with CODEVIEW=2, don't use PCH...
! 86: !ifdef MKNT
! 87: NO_PCH=1
! 88: !endif
! 89: !endif
! 90:
1.1 root 91: !if "$(DEBUG)" != "0"
92: DEBUGSUF=D
93: DEBDEFS=/D_DEBUG
94: !ifdef MKNT
1.1.1.2 ! root 95: DEBOPTS=/Od
! 96: !if "$(CODEVIEW)" == "1"
! 97: DEBOPTS=/Od /Zi
! 98: !endif
1.1 root 99: !else
100: DEBOPTS=/Odr /f
101: !endif
102: !else
103: DEBUGSUF=
104: DEBDEFS=
105: !ifdef MKNT
1.1.1.2 ! root 106: DEBOPTS=/Os
! 107: !if "$(CODEVIEW)" == "1"
! 108: DEBOPTS=/Os /Zi
! 109: !endif
1.1 root 110: !else
111: DEBOPTS=/Oxt
112: !endif
113: !endif
114:
1.1.1.2 ! root 115: #REVIEW_NT: $(FOO) + blah still doesn't work under NT nmake!!
! 116: !ifndef MKNT
1.1 root 117: !if "$(CODEVIEW)" == "1"
118: DEBOPTS=$(DEBOPTS) /Zi
119: !endif
120: !endif
121:
122: # CVEXTRA used for select CodeView information (main files only)
123: !if "$(CODEVIEW)" == "2"
124: CVEXTRA=/Zi
125: !endif
126:
127: !if "$(MODEL)"=="s" || "$(MODEL)"=="S"
128: CL_MODEL=/AS
129: !else
130: !if "$(MODEL)"=="m" || "$(MODEL)"=="M"
131: CL_MODEL=/AM
132: !else
133: !if "$(MODEL)"=="c" || "$(MODEL)"=="C"
134: CL_MODEL=/AC
135: !else
136: !if "$(MODEL)"=="l" || "$(MODEL)"=="L"
137: CL_MODEL=/AL
138: !else
139: !if "$(MODEL)"=="n" || "$(MODEL)"=="N"
140: # Windows NT
141: CL_MODEL=/D_NTWIN /Di386
142: MKNT=1
143: !else
144: !error MODEL must be one of S, M, L, or N
145:
146: !endif
147: !endif
148: !endif
149: !endif
150: !endif
151:
152: !if "$(TARGET)"=="r" || "$(TARGET)"=="R"
153: !ifdef MKNT
154: TARGDEFS=
155: TARGOPTS=
156: EXPFLAG=
157: !else
158: TARGDEFS=/D_DOS
159: TARGOPTS=
160: EXPFLAG=
161: !endif
162: !else
163:
164: !if "$(TARGET)"=="w" || "$(TARGET)"=="W"
165: MKWIN=1
166: !ifdef MKNT
167: TARGDEFS=/D_WINDOWS /DWINVER=0x030a
1.1.1.2 ! root 168: TARGOPTS=/G3d
1.1 root 169: EXPFLAG=
170: !else
171: TARGDEFS=/D_WINDOWS
172: TARGOPTS=/GA /GEs /G2
173: EXPFLAG=/GEe
174: !endif
175:
176: !else
177:
178: !error TARGET must be one of W, R
179:
180: !endif
181: !endif
182:
183:
184: !if "$(OBJ)" == ""
185: D=$$$(MODEL)$(TARGET)$(DEBUGSUF)
186: !if "$(DLL)" != "0"
187: D=$D.dll
1.1.1.2 ! root 188: !ifdef MKNT
! 189: #REVIEW_NT: above assign does not work...
! 190: D=$$$(MODEL)$(TARGET)$(DEBUGSUF).dll
! 191: !endif
1.1 root 192: !endif
193: !else
194: D=$(OBJ)
195: !endif
196:
197: DEFS=$(DEBDEFS) $(TARGDEFS)
198: CL_OPT=/W3 $(DEBOPTS) $(TARGOPTS) $(OPT)
199:
200: !if "$(DLL)" == "0"
201: # Normal library
202: GOAL=$(MODEL)afxc$(TARGET)$(DEBUGSUF)
203: !else
204: # DLL library (SS!=DS) - only Large model supported (compact model is possible)
205: GOAL=$(MODEL)afxd$(TARGET)$(DEBUGSUF)
1.1.1.2 ! root 206: !ifndef MKNT
1.1 root 207: CL_MODEL=$(CL_MODEL)w
208: TARGOPTS=/GD /G2
1.1.1.2 ! root 209: !else
! 210: TARGOPTS=/D_WINDLL
! 211: !endif
1.1 root 212: # /GD will define _WINDLL
213: !endif
214:
215: #############################################################################
216: # Library Components
217:
218: OBJECT=$D\object.obj $D\except.obj $D\dumpcont.obj $D\abort.obj \
219: $D\assert.obj $D\archive.obj $D\archivex.obj $D\memory.obj \
220: $D\validadd.obj $D\dumpinit.obj $D\version.obj
221:
222: FILES=$D\file.obj $D\filetxt.obj $D\filemem.obj $D\filex.obj
223:
224: COLLECTIONS=$D\array_b.obj $D\array_d.obj $D\array_o.obj $D\array_p.obj \
225: $D\array_s.obj $D\array_w.obj $D\list_o.obj $D\list_p.obj \
226: $D\list_s.obj $D\map_pp.obj $D\map_pw.obj $D\map_so.obj \
227: $D\map_sp.obj $D\map_ss.obj $D\map_wo.obj $D\map_wp.obj $D\plex.obj
228:
229: MISC=$D\string.obj $D\stringex.obj $D\time.obj
230:
231: WINDOWS=$D\window.obj $D\wingdi.obj $D\winctrl.obj $D\winstr.obj \
232: $D\winapp.obj $D\winmain.obj $D\winmenu.obj $D\winmdi.obj $D\trace.obj
233:
234: !ifdef MKNT
235: WINEXTRAS=$D\winbtn.obj $D\windlgs.obj
236: !else
237: WINEXTRAS=$D\penctrl.obj $D\winbtn.obj $D\windlgs.obj
238: !endif
239:
240: !if "$(DLL)" == "0"
241: OLE= $D\olemisc.obj $D\olefile.obj $D\olecli.obj $D\oleui.obj $D\oleui2.obj \
242: $D\olesvr.obj
243: !else
244: OLE= # OLE not supported for DLLs
245: !endif
246:
247: OBJS=$(OBJS) $(OBJECT) $(FILES) $(COLLECTIONS) $(MISC)
248:
249: !ifdef MKWIN
250: OBJS=$(OBJS) $(WINDOWS) $(WINEXTRAS) $(OLE)
251: !endif
252:
253:
254:
255:
256: #############################################################################
257: # Set CPPFLAGS for use with .cpp.obj and .c.obj rules
258: # Define rule for use with OBJ directory
259: # C++ uses a PCH file
260:
261: CPPFLAGS=$(CPPFLAGS) $(CL_STANDARD) $(CL_MODEL) $(CL_OPT) $(DEFS)
262:
263: !ifndef NO_PCH
264: PCH_FILE=$D\afxpch.pch
265: CPPFLAGS=$(CPPFLAGS) /Yu /Fp$(PCH_FILE)
266: !else
267: PCH_FILE=
268: !endif
269:
270: CFLAGS=$(CFLAGS) $(CL_STANDARD) $(CL_MODEL) $(CL_OPT) $(DEFS)
271:
272: .SUFFIXES : .cpp
273:
274: .cpp{$D}.obj:
275: !ifdef MKNT
276: $(CPP) $(CPPFLAGS) /c /Fo$@ $<
277: !else
278: $(CPP) @<<
279: $(CPPFLAGS) /c /Fo$@ $<
280: <<
281: !endif
282:
283: .c{$D}.obj:
284: !ifdef MKNT
285: $(CC) $(CFLAGS) /c /Fo$@ $<
286: !else
287: $(CC) @<<
288: $(CFLAGS) /c /Fo$@ $<
289: <<
290: !endif
291:
292: #############################################################################
293: # Goal to build
294:
295: goal: $D ..\lib\$(GOAL).lib
296:
297: $D:
298: IF NOT EXIST $D mkdir $D
299:
300: clean:
301: -erase $D\*.obj
302: -erase $D\*.pch
303: -rmdir $D
304:
305:
306: #############################################################################
307: # Precompiled header file
308:
309: !ifndef NO_PCH
310: INC_DIR=..\include
311: HDRS=$(INC_DIR)\afx.h $(INC_DIR)\afx.inl $(INC_DIR)\afxcoll.h \
312: $(INC_DIR)\afxwin.h $(INC_DIR)\afxwin.inl $(INC_DIR)\afxmsg.h \
313: $(INC_DIR)\afxres.h \
314: $(INC_DIR)\afxole.h $(INC_DIR)\afxoleui.h
315:
316: $D\object.obj $(PCH_FILE): object.cpp $(HDRS)
1.1.1.2 ! root 317: $(CPP) /c /Yc /Fp$(PCH_FILE) $(CL_STANDARD) $(CL_MODEL) $(CL_OPT) $(DEFS) $(CVEXTRA) /Fo$D\object.obj object.cpp
! 318: !else
! 319: $D\object.obj: object.cpp
! 320: $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\object.obj object.cpp
1.1 root 321: !endif
322:
323: ############################################################################
324: # CodeView for select files
325: !if "$(CODEVIEW)"=="2"
326: $D\memory.obj : memory.cpp
327: $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\memory.obj memory.cpp
328:
329: !ifdef MKWIN
330: $D\winmain.obj : winmain.cpp
331: $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\winmain.obj winmain.cpp
332:
333: $D\window.obj : window.cpp
334: $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\window.obj window.cpp
335:
336: $D\winapp.obj : winapp.cpp
337: $(CPP) $(CPPFLAGS) $(CVEXTRA) /c /Fo$D\winapp.obj winapp.cpp
338: !endif
339: !endif
340:
341: #############################################################################
342: # Windows 3.0 loader export/version number
343: $D\version.obj : version.cpp
344: !ifdef MKNT
345: $(CPP) $(CPPFLAGS) $(EXPFLAG) /c /Fo$D\version.obj version.cpp
346: !else
347: $(CPP) @<<
348: $(CPPFLAGS) $(EXPFLAG) /c /Fo$D\version.obj version.cpp
349: <<
350: !endif
351:
352:
353: #############################################################################
354: # Library results
355:
356: ..\lib\$(GOAL).lib: $D $(OBJS)
357: -erase $@
358: !ifdef MKNT
359: coff -lib -out:..\lib\$(GOAL).lib $(OBJS)
360: !else
361: lib /PAGESIZE:128 @<<
362: ..\lib\$(GOAL).lib
363: y
364: $(OBJS)
365: nul
366: ;
367: <<
368: !endif
369:
370: #############################################################################
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.