1 | # $Id: makefile 436 2018-05-25 00:57:16Z rlwalsh $
|
---|
2 |
|
---|
3 | #
|
---|
4 | # makefile:
|
---|
5 | # makefile for src/helpers directory.
|
---|
6 | # For use with IBM NMAKE, which comes with the IBM compilers,
|
---|
7 | # the Developer's Toolkit, and the DDK.
|
---|
8 | #
|
---|
9 | # This makefile is even more complicated than the other makefiles
|
---|
10 | # because the helpers code has been designed to be independent
|
---|
11 | # of any single project. For example, the helpers code is used
|
---|
12 | # by XWorkplace also. As a result, I had to design a way so that
|
---|
13 | # this makefile can produce output in a variable directory, with
|
---|
14 | # variable compiler flags, and so on. This is done via environment
|
---|
15 | # variables (see below).
|
---|
16 | #
|
---|
17 | # Even worse, with V0.9.5, I chose to create a shared runtime DLL
|
---|
18 | # for the various WarpIN executables. For that, I chose to use
|
---|
19 | # a separate makefile (makefile_dll). In order to share make
|
---|
20 | # definitions, these have been put into separate .in files in
|
---|
21 | # this directory, which are included via nmake !include.
|
---|
22 | #
|
---|
23 | # Called from: main makefile
|
---|
24 | #
|
---|
25 | # Required environment variables:
|
---|
26 | #
|
---|
27 | # -- PROJECT_BASE_DIR: where to find setup.in; this should
|
---|
28 | # be the root directory of the project, e.g. "C:\cvs\warpin"
|
---|
29 | # or "C:\cvs\xworkplace"
|
---|
30 | #
|
---|
31 | # -- HELPERS_OUTPUT_DIR: where to create output files (*.obj, helpers.lib)
|
---|
32 | # this should be a "bin" directory (e.g. "C:\cvs\warpin\bin"
|
---|
33 | #
|
---|
34 | # -- CC_HELPERS: compiler command line for compiling C files.
|
---|
35 | # With VAC++, this should include the /Ge+ (compile to EXE)
|
---|
36 | # option to allow linking the library to both EXE and DLL
|
---|
37 | # files.
|
---|
38 | # If you're using the "dll" target, specify /Ge- instead.
|
---|
39 | #
|
---|
40 | # -- MAINMAKERUNNING: if this is NOT defined, this makefile
|
---|
41 | # will recurse to the makefile in $(PROJECT_BASE_DIR).
|
---|
42 | # So to have this makefile run successfully, define this
|
---|
43 | # variable to something.
|
---|
44 | #
|
---|
45 | # This variable was introduced to be able to start a build
|
---|
46 | # process from src\helpers as well. However, when your own
|
---|
47 | # project makefile calls src\helpers\makefile, you must set
|
---|
48 | # this to something.
|
---|
49 | #
|
---|
50 | # Input: ./*.c
|
---|
51 | #
|
---|
52 | # Targets: specify the target(s) to be made, which can be:
|
---|
53 | #
|
---|
54 | # -- "all" (default): create helpers.lib in addition
|
---|
55 | # to all the output .obj files in $(HELPERS_OUTPUT_DIR).
|
---|
56 | #
|
---|
57 | # This contains all helpers (plain C, control program,
|
---|
58 | # and PM).
|
---|
59 | #
|
---|
60 | # This makes linking a bit easier since you don't have to
|
---|
61 | # keep in mind the millions of object files. Still, you
|
---|
62 | # should be sure to include the proper headers in your
|
---|
63 | # code.
|
---|
64 | #
|
---|
65 | # Alternatively, you can call this makefile with certain
|
---|
66 | # targets explicitly specified. However, you must then
|
---|
67 | # make sure that the resulted object files are linked
|
---|
68 | # properly, because some of the more advanced helpers
|
---|
69 | # require other helpers.
|
---|
70 | #
|
---|
71 | # -- "plainc": create "plainc.lib", which contains
|
---|
72 | # platform-independent helpers code only (no control
|
---|
73 | # program helpers, no PM helpers).
|
---|
74 | #
|
---|
75 | # This is included if you specify "all". Use this if
|
---|
76 | # you want a subset of the helpers only.
|
---|
77 | #
|
---|
78 | # -- "cp": create "cp.lib", which contains "plainc" plus
|
---|
79 | # control program helpers.
|
---|
80 | #
|
---|
81 | # This is included if you specify "all". Use this if
|
---|
82 | # you want a subset of the helpers only.
|
---|
83 | #
|
---|
84 | # Edit "setup.in" to set up the make process.
|
---|
85 | #
|
---|
86 |
|
---|
87 | # Say hello to yourself.
|
---|
88 | !if [@echo +++++ Entering $(MAKEDIR)\makefile]
|
---|
89 | !endif
|
---|
90 |
|
---|
91 | # helpers_pre.in: sets up more environment variables
|
---|
92 | # and defines $(OBJ), which contains all object targets
|
---|
93 | !include helpers_pre.in
|
---|
94 |
|
---|
95 | # Check required macros
|
---|
96 |
|
---|
97 | !ifdef MAINMAKERUNNING
|
---|
98 | !ifndef CC_HELPERS
|
---|
99 | !error CC_HELPERS not defined
|
---|
100 | !endif
|
---|
101 | !ifndef PROJECT_BASE_DIR
|
---|
102 | !error PROJECT_BASE_DIR not defined
|
---|
103 | !endif
|
---|
104 | !ifndef HELPERS_OUTPUT_DIR
|
---|
105 | !error HELPERS_OUTPUT_DIR not defined
|
---|
106 | !endif
|
---|
107 | !ifndef CC_HELPERS
|
---|
108 | !error CC_HELPERS not defined
|
---|
109 | !endif
|
---|
110 | !endif
|
---|
111 |
|
---|
112 | # The main target:
|
---|
113 | # If we're called from the main makefile, MAINMAKERUNNING is defined,
|
---|
114 | # and we'll set $(OBJS) as our targets (which will go on).
|
---|
115 | # Otherwise, we call the main makefile, which will again call ourselves later.
|
---|
116 |
|
---|
117 | # Support nmake32 syntax V1.0.12 (2018-05-07) [slevine]
|
---|
118 |
|
---|
119 | !ifndef MAINMAKERUNNING
|
---|
120 | all: callmainmake
|
---|
121 | !else
|
---|
122 | all: $(OUTPUTDIR)\helpers.lib
|
---|
123 | !endif
|
---|
124 | @echo ----- Leaving $(MAKEDIR)
|
---|
125 |
|
---|
126 | !ifndef MAINMAKERUNNING
|
---|
127 | plainc: callmainmake
|
---|
128 | !else
|
---|
129 | plainc: $(OUTPUTDIR)\plainc.lib
|
---|
130 | !endif
|
---|
131 | @echo ----- Leaving $(MAKEDIR)
|
---|
132 |
|
---|
133 | !ifndef MAINMAKERUNNING
|
---|
134 | cp: callmainmake
|
---|
135 | !else
|
---|
136 | cp: $(OUTPUTDIR)\cp.lib
|
---|
137 | !endif
|
---|
138 | @echo ----- Leaving $(MAKEDIR)
|
---|
139 | @echo ----- Leaving $(MAKEDIR)
|
---|
140 |
|
---|
141 |
|
---|
142 | callmainmake:
|
---|
143 | @echo $(MAKEDIR)\makefile: Recursing to main makefile.
|
---|
144 | @cd $(PROJECT_BASE_DIR)
|
---|
145 | @$(MAKE) -nologo
|
---|
146 | @echo $(MAKEDIR)\makefile: Returned from main makefile. Done.
|
---|
147 |
|
---|
148 | # The "dep" target: run fastdep on the sources.
|
---|
149 | # "nmake dep" gets called from src\makefile if nmake dep
|
---|
150 | # is running on the main makefile.
|
---|
151 | dep:
|
---|
152 | $(RUN_FASTDEP) *.c
|
---|
153 | @echo ----- Leaving $(MAKEDIR)
|
---|
154 |
|
---|
155 | # Define the main dependency between the output HELPERS.LIB and
|
---|
156 | # all the object files.
|
---|
157 | # $? represents the names of all dependent files that are
|
---|
158 | # out-of-date with respect to the target file.
|
---|
159 | # The exclamation point ( ! ) preceding the LIB command causes NMAKE
|
---|
160 | # to execute the LIB command once for each dependent file in the list.
|
---|
161 |
|
---|
162 | $(OUTPUTDIR)\helpers.lib: $(OBJS) makefile
|
---|
163 | !ifdef EMX
|
---|
164 | !emxomfar cr $* $?
|
---|
165 | !else
|
---|
166 | - del $@
|
---|
167 | # support both 3.08 and 3.6.5 ilib syntax V1.0.9 (2011-11-30) [slevine]
|
---|
168 | !ifdef CXXMAIN
|
---|
169 | # 2011-11-30 SHL fixme for no public symbols warning
|
---|
170 | -4 ilib /nol /nobr /out:$@ @<<$(TEMP)\ilib.lnk
|
---|
171 | $(OBJS)
|
---|
172 | <<
|
---|
173 | !else
|
---|
174 | ilib /nol /nob $@ @<<$(TEMP)\ilib.lnk
|
---|
175 | +$(OBJS: =&^
|
---|
176 | );
|
---|
177 | <<
|
---|
178 | !endif
|
---|
179 | !endif
|
---|
180 |
|
---|
181 | # same thing for cp.lib
|
---|
182 | $(OUTPUTDIR)\cp.lib: $(CPOBJS) makefile
|
---|
183 | !ifdef EMX
|
---|
184 | !emxomfar cr $* $?
|
---|
185 | !else
|
---|
186 | - del $@
|
---|
187 | # support both 3.08 and 3.6.5 ilib syntax V1.0.9 (2011-11-30) [slevine]
|
---|
188 | !ifdef CXXMAIN
|
---|
189 | -4 ilib /nol /nobr /out:$@ @<<$(TEMP)\ilib.lnk
|
---|
190 | $(CPOBJS)
|
---|
191 | <<
|
---|
192 | !else
|
---|
193 | ilib /nol /nob $@ @<<$(TEMP)\ilib.lnk
|
---|
194 | +$(CPOBJS: =&^
|
---|
195 | );
|
---|
196 | <<
|
---|
197 | !endif
|
---|
198 | !endif
|
---|
199 |
|
---|
200 | # same thing for plainc.lib
|
---|
201 | $(OUTPUTDIR)\plainc.lib: $(PLAINCOBJS) makefile
|
---|
202 | !ifdef EMX
|
---|
203 | !emxomfar cr $* $?
|
---|
204 | !else
|
---|
205 | - del $@
|
---|
206 | # support both 3.08 and 3.6.5 ilib syntax V1.0.9 (2011-11-30) [slevine]
|
---|
207 | !ifdef CXXMAIN
|
---|
208 | -4 ilib /nol /nobr /out:$@ @<<$(TEMP)\ilib.lnk
|
---|
209 | $(PLAINCOBJS)
|
---|
210 | <<
|
---|
211 | !else
|
---|
212 | ilib /nol /nob $@ @<<$(TEMP)\ilib.lnk
|
---|
213 | +$(PLAINCOBJS: =&^
|
---|
214 | );
|
---|
215 | <<
|
---|
216 | !endif
|
---|
217 | !endif
|
---|
218 |
|
---|
219 | !include helpers_post.in
|
---|
220 |
|
---|
221 | ###################################################
|
---|
222 | #
|
---|
223 | # "test" target: for test cases
|
---|
224 | #
|
---|
225 | ###################################################
|
---|
226 |
|
---|
227 | TESTCASE_DIR = testcase
|
---|
228 |
|
---|
229 | DEBUGDIALOG =
|
---|
230 | !ifdef DBGDLG
|
---|
231 | DEBUGDIALOG = /DDEBUG_DIALOG_WINDOWS=1
|
---|
232 | !endif
|
---|
233 |
|
---|
234 | TESTCASE_CC = icc /c /ti+ /w2 /ss /se /D__DEBUG__=1 $(DEBUGDIALOG) /i$(HELPERS_BASE)\include /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c
|
---|
235 |
|
---|
236 | .c{$(TESTCASE_DIR)}.obj:
|
---|
237 | @echo $(MAKEDIR)\makefile: Compiling $(@B).c
|
---|
238 | @echo INCLUDE is $(INCLUDE)
|
---|
239 | $(TESTCASE_CC)
|
---|
240 |
|
---|
241 | # testcase executables
|
---|
242 | TESTCASE_TARGETS = \
|
---|
243 | dosh.exe \
|
---|
244 | dialog.exe \
|
---|
245 | exeh.exe \
|
---|
246 | fdlg.exe \
|
---|
247 | xmap.exe \
|
---|
248 | vcard.exe
|
---|
249 |
|
---|
250 | # dialog.exe
|
---|
251 | DIALOG_TEST_OBJS = \
|
---|
252 | $(TESTCASE_DIR)\dialog.obj \
|
---|
253 | $(TESTCASE_DIR)\_test_dialog.obj \
|
---|
254 | $(TESTCASE_DIR)\winh.obj \
|
---|
255 | $(TESTCASE_DIR)\xstring.obj \
|
---|
256 | $(TESTCASE_DIR)\linklist.obj \
|
---|
257 | $(TESTCASE_DIR)\cctl_checkcnr.obj \
|
---|
258 | $(TESTCASE_DIR)\cnrh.obj \
|
---|
259 | $(TESTCASE_DIR)\comctl.obj \
|
---|
260 | $(TESTCASE_DIR)\stringh.obj \
|
---|
261 | $(TESTCASE_DIR)\dosh.obj \
|
---|
262 | $(TESTCASE_DIR)\except.obj \
|
---|
263 | $(TESTCASE_DIR)\debug.obj \
|
---|
264 | $(TESTCASE_DIR)\textview.obj \
|
---|
265 | $(TESTCASE_DIR)\textv_html.obj \
|
---|
266 | $(TESTCASE_DIR)\tmsgfile.obj \
|
---|
267 | $(TESTCASE_DIR)\datetime.obj \
|
---|
268 | $(TESTCASE_DIR)\tree.obj \
|
---|
269 | $(TESTCASE_DIR)\gpih.obj
|
---|
270 |
|
---|
271 | $(TESTCASE_DIR)\dialog.obj: ..\..\include\helpers\dialog.h
|
---|
272 | $(TESTCASE_DIR)\_test_dialog.obj: ..\..\include\helpers\dialog.h
|
---|
273 |
|
---|
274 | dialog.exe: $(DIALOG_TEST_OBJS)
|
---|
275 | ilink /debug /optfunc /pmtype:pm $(DIALOG_TEST_OBJS) pmprintf.lib /o:$@
|
---|
276 |
|
---|
277 | # dosh.exe
|
---|
278 | DOSH_TEST_OBJS = \
|
---|
279 | $(TESTCASE_DIR)\dosh.obj \
|
---|
280 | $(TESTCASE_DIR)\_test_dosh.obj
|
---|
281 |
|
---|
282 | dosh.exe: $(DOSH_TEST_OBJS)
|
---|
283 | ilink /debug /optfunc /pmtype:vio $(DOSH_TEST_OBJS) pmprintf.lib /o:$@
|
---|
284 |
|
---|
285 | # exeh.exe
|
---|
286 | EXEH_TEST_OBJS = \
|
---|
287 | $(TESTCASE_DIR)\dosh.obj \
|
---|
288 | $(TESTCASE_DIR)\exeh.obj \
|
---|
289 | $(TESTCASE_DIR)\stringh.obj \
|
---|
290 | $(TESTCASE_DIR)\xstring.obj \
|
---|
291 | $(TESTCASE_DIR)\_test_exeh.obj
|
---|
292 |
|
---|
293 | exeh.exe: $(EXEH_TEST_OBJS)
|
---|
294 | ilink /debug /optfunc /pmtype:vio $(EXEH_TEST_OBJS) pmprintf.lib /o:$@
|
---|
295 |
|
---|
296 | # fdlg.exe
|
---|
297 | FDLG_TEST_OBJS = \
|
---|
298 | $(TESTCASE_DIR)\dosh.obj \
|
---|
299 | $(TESTCASE_DIR)\gpih.obj \
|
---|
300 | $(TESTCASE_DIR)\winh.obj \
|
---|
301 | $(TESTCASE_DIR)\stringh.obj \
|
---|
302 | $(TESTCASE_DIR)\xstring.obj \
|
---|
303 | $(TESTCASE_DIR)\_call_filedlg.obj
|
---|
304 |
|
---|
305 | fdlg.exe: $(FDLG_TEST_OBJS)
|
---|
306 | ilink /debug /pmtype:pm $(FDLG_TEST_OBJS) /o:$@
|
---|
307 |
|
---|
308 | # xmap.exe
|
---|
309 | MAP_TEST_OBJS = \
|
---|
310 | $(TESTCASE_DIR)\map_vac.obj \
|
---|
311 | $(TESTCASE_DIR)\linklist.obj \
|
---|
312 | $(TESTCASE_DIR)\stringh.obj \
|
---|
313 | $(TESTCASE_DIR)\xstring.obj \
|
---|
314 | $(TESTCASE_DIR)\_test_map.obj
|
---|
315 |
|
---|
316 | xmap.exe: $(MAP_TEST_OBJS)
|
---|
317 | ilink /debug /optfunc /pmtype:vio $(MAP_TEST_OBJS) pmprintf.lib /o:$@
|
---|
318 |
|
---|
319 | # vcard.exe
|
---|
320 | VCARD_TEST_OBJS = \
|
---|
321 | $(TESTCASE_DIR)\vcard.obj \
|
---|
322 | $(TESTCASE_DIR)\_test_vcard.obj \
|
---|
323 | $(TESTCASE_DIR)\xstring.obj \
|
---|
324 | $(TESTCASE_DIR)\stringh.obj \
|
---|
325 | $(TESTCASE_DIR)\linklist.obj \
|
---|
326 | $(TESTCASE_DIR)\dosh.obj \
|
---|
327 | $(TESTCASE_DIR)\prfh.obj \
|
---|
328 | $(TESTCASE_DIR)\nls.obj \
|
---|
329 | $(TESTCASE_DIR)\except.obj \
|
---|
330 | $(TESTCASE_DIR)\debug.obj \
|
---|
331 | $(TESTCASE_DIR)\tree.obj
|
---|
332 |
|
---|
333 | vcard.exe: $(VCARD_TEST_OBJS)
|
---|
334 | ilink /debug /pmtype:vio $(VCARD_TEST_OBJS) /o:$@
|
---|
335 |
|
---|
336 | test: $(TESTCASE_TARGETS)
|
---|
337 |
|
---|
338 |
|
---|