1#
2# Jamfile to build Jam (a make(1)-like program)
3#
4# There are no user-serviceable parts in this file.
5#
6# Put executables in platform-specific  subdirectory.
7
8if $(VMS) 	{ LOCATE_TARGET ?= [.binvms] ; }
9else if $(MAC) 	{ LOCATE_TARGET ?= :bin.mac ; }
10else 		{ LOCATE_TARGET ?= bin.$(OSFULL[1]:L) ; }
11
12# Leave generated source in current directory; it would be nice to use
13# these lines below to build the source into the platform-specific
14# directory, but getting scan.c to include the right jambase.h is
15# hard: with ""'s, it always gets the bootstrap version; with <>'s,
16# it won't find the bootstrap version.
17
18# SEARCH_SOURCE ?= $(LOCATE_TARGET) $(DOT) ;
19# LOCATE_SOURCE ?= $(LOCATE_TARGET) ;
20
21#
22# We have some different files for UNIX, VMS, and NT.
23#
24
25if $(NT) 	{ code = execunix.c filent.c pathunix.c ; } 
26else if $(MINGW) { code = execunix.c filent.c pathunix.c ; } 
27else if $(OS2)	{ code = execunix.c fileos2.c pathunix.c ; } 
28else if $(VMS) 	{ code = execvms.c filevms.c pathvms.c ; } 
29else if $(MAC)	{ code = execmac.c filemac.c pathmac.c ; }
30else 		{ code = execunix.c fileunix.c pathunix.c ; }
31
32# For jam profiling/debugging.
33
34if $(PROFILE)
35{
36	CCFLAGS += -pg ;
37	LINKFLAGS += -pg ;
38	LOCATE_TARGET = $(LOCATE_TARGET)/pg ;
39}
40
41if $(DEBUG)
42{
43	CCFLAGS += -g ;
44	C++FLAGS += -g ;
45	LINKFLAGS += -g ;
46	LOCATE_TARGET = $(LOCATE_TARGET)/g ;
47}
48
49# We have to signal jam.h for these
50
51if $(OS) = NT 			{ CCFLAGS += /DNT ; }
52
53### LOCAL CHANGE
54# 
55# Include:
56# * header caching
57# * jamfile caching
58# * definition of JAM_TARGETS variable
59#
60DEFINES += OPT_HEADER_CACHE_EXT ;
61DEFINES += OPT_JAMFILE_CACHE_EXT ;
62DEFINES += OPT_JAM_TARGETS_VARIABLE_EXT ;
63#
64### LOCAL CHANGE
65
66### LOCAL CHANGE
67# 
68# Include rule profiling support, if specified in the environment.
69#
70if $(OPT_RULE_PROFILING_EXT) {
71	DEFINES += OPT_RULE_PROFILING_EXT ;
72}
73#
74### LOCAL CHANGE
75
76### LOCAL CHANGE
77# 
78# Include stat cache server under BeOS.
79#
80if $(OS) = BEOS {
81	DEFINES += OPT_STAT_CACHE_SERVER_EXT ;
82}
83#
84### LOCAL CHANGE
85
86# Do we know yacc?
87
88if $(YACC) 	{ code += jamgram.y ; }
89else            { code += jamgram.c ; }
90
91#
92# Build the jamgram.y from the jamgram.yy
93# yyacc is a slippery script that makes grammars a little
94# easier to read/maintain.
95#
96
97if $(YACC) && $(SUFEXE) = ""
98{
99	GenFile jamgram.y jamgramtab.h : yyacc jamgram.yy ;
100}
101
102### LOCAL CHANGE
103# 
104# These files contain locally developed improvements.
105#
106code += jcache.c ;
107# code primarily not written locally, but grabbed from the net
108code += hcache.c ;
109#
110### LOCAL CHANGE
111
112### LOCAL CHANGE
113# 
114# Include stat cache server under BeOS.
115#
116if $(OS) = BEOS {
117	code += beos_stat_cache.c ;
118}
119#
120### LOCAL CHANGE
121
122#
123# How to build the compiled in jambase.
124#
125
126Main		mkjambase : mkjambase.c ;
127
128if $(VMS)
129{
130	CC = cxx ;
131	LINK = cxxlink ;
132	CCFLAGS += /define=VMS ;
133}
134
135if $(OS) = BEOS {
136}
137
138#
139# The guts of the Jamfile: how to build Jam
140#
141
142Main 		jam : jam.c jambase.c ;
143LinkLibraries 	jam : libjam.a ;
144GenFile 	jambase.c : mkjambase Jambase ;
145
146if $(OS) = BEOS {
147	local haveBone = [ GLOB /boot/develop/headers/be/bone/arpa : inet.h ] ;
148	if ! $(haveBone)	{
149		LINKLIBS on jam += -lnet ;
150	}
151	local haveZeta = [ GLOB /boot/beos/system/lib : libzeta.so ] ;
152	if $(haveZeta) {
153		DEFINES += _ZETA_USING_DEPRECATED_API_=1 ;
154	}
155}
156
157Library         libjam.a :
158		    builtins.c command.c compile.c $(code) expand.c
159		    glob.c hash.c headers.c lists.c make.c make1.c
160		    newstr.c option.c parse.c regexp.c rules.c scan.c
161		    search.c timestamp.c variable.c ;
162
163
164if $(BINDIR) 	{ InstallBin $(BINDIR) : jam ; }
165
166### LOCAL CHANGE
167# 
168# Build stat cache server under BeOS.
169#
170if $(OS) = BEOS {
171	# RC must be defined, if we are to compile the resources.
172	if ! $(RC) && ! $(NO_STAT_CACHE_SERVER_RESOURCES) {
173		Echo "NOTE: The variable RC is not defined, and therefore the" ;
174		Echo "NOTE: built StatCacheServer won't have resources (it will thus" ;
175		Echo "NOTE: appear in the Deskbar). If you want to have resources," ;
176		Echo "NOTE: define RC as an absolute or relative path referring to" ;
177		Echo "NOTE: the rc program, or just the program name, if it lives in" ;
178		Echo "NOTE: the PATH." ;
179		NO_STAT_CACHE_SERVER_RESOURCES = 1 ;
180	}
181
182	rule CompileResources
183	{
184		SEARCH on $(2) += $(SEARCH_SOURCE) ;
185		MakeLocate $(1) : $(LOCATE_TARGET) ;
186		Depends $(1) : $(2) ;
187		LocalClean clean : $(1) ;
188	}
189
190	actions CompileResources
191	{
192		$(RC) -o "$(1)" "$(2)"
193	}
194
195	rule AddResources
196	{
197		SEARCH on $(2) += $(SEARCH_SOURCE) ;
198		Depends $(1) : $(2) ;
199	}
200
201	actions AddResources
202	{
203		xres -o "$(1)" $(2)
204	}
205
206	LINK on StatCacheServer = g++ ;
207	LINKLIBS on StatCacheServer
208		= [ on StatCacheServer return $(LINKLIBS) ] -lbe ;
209	Main StatCacheServer : StatCacheServer.cpp ;
210	if ! $(NO_STAT_CACHE_SERVER_RESOURCES) {
211		CompileResources StatCacheServer.rsrc : StatCacheServer.rdef ;
212		AddResources StatCacheServer : StatCacheServer.rsrc ;
213	}
214	if $(BINDIR) 	{ InstallBin $(BINDIR) : StatCacheServer ; }
215}
216#
217### LOCAL CHANGE
218
219#
220# Distribution making from here on out.
221#
222
223ALLSOURCE =
224	Build.com Build.mpw Jam.html Jambase Jambase.html Jamfile
225	Jamfile.html Makefile Porting README RELNOTES builtins.c builtins.h
226	command.c command.h compile.c compile.h execcmd.h execmac.c
227	execunix.c execvms.c expand.c expand.h filemac.c filent.c
228	fileos2.c filesys.h fileunix.c filevms.c glob.c hash.c hash.h
229	headers.c headers.h jam.c jam.h jambase.c jambase.h jamgram.c
230	jamgram.h jamgram.y jamgram.yy jamgramtab.h lists.c lists.h
231	make.c make.h make1.c mkjambase.c newstr.c newstr.h option.c
232	option.h parse.c parse.h patchlevel.h pathmac.c pathsys.h
233	pathunix.c pathvms.c regexp.c regexp.h rules.c rules.h scan.c
234	scan.h search.c search.h timestamp.c timestamp.h variable.c
235	variable.h yyacc ;
236
237### LOCAL CHANGE
238#
239ALLSOURCE += LOCAL_DIFFERENCES.txt ;
240#
241### LOCAL CHANGE
242
243rule Ball
244{
245	NotFile balls ;
246	Depends balls : $(<) ;
247
248	DEPENDS $(<) : $(>) ;
249
250	switch $(<) 
251	{
252	case *.tar : Tar $(<) : $(>) ;
253	case *.shar : Shar $(<) : $(>) ;
254	case *.zip : Zip $(<) : $(>) ;
255	}
256}
257
258VERSION = jam-2.5rc1 ;
259
260actions Tar
261{
262	ln -s . $(VERSION)
263	tar cvhf $(<) $(VERSION)/$(>)
264	rm $(VERSION)
265}
266
267actions Shar
268{
269	shar $(>) > $(<)
270}
271
272actions Zip
273{
274	zip $(<) $(>) 
275}
276
277Ball $(VERSION).shar : $(ALLSOURCE) ;
278Ball $(VERSION).tar : $(ALLSOURCE) ;
279Ball $(VERSION).zip : $(ALLSOURCE) ;
280