source: trunk/src/helpers/makefile@ 244

Last change on this file since 244 was 243, checked in by umoeller, 23 years ago

New build system, multimedia, other misc fixes.

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