source tree restructured a little (should i move *.[ch] to src/ ?)
[k8jam.git] / Jamfile
blobd8d8957e7e500bac609239fadb75c003a205b64e
2 # Jamfile to build Jam (a make(1)-like program)
4 # There are no user-serviceable parts in this file.
6 # Put executables in platform-specific  subdirectory.
8 include Jamrules ;
10 # note that we use the target directory 'bin.unix' to ensure that
11 # 'make install' and 'make uninstall' work correctly
13 if $(VMS)   { LOCATE_TARGET ?= [.binvms] ; }
14 else if $(MAC)  { LOCATE_TARGET ?= :bin.mac ; }
15 else if $(UNIX) { LOCATE_TARGET ?= bin.unix ; }
16 else    { LOCATE_TARGET ?= bin.$(OSFULL[1]:L) ; }
18 # Leave generated source in current directory; it would be nice to use
19 # these lines below to build the source into the platform-specific
20 # directory, but getting scan.c to include the right jambase.h is
21 # hard: with ""'s, it always gets the bootstrap version; with <>'s,
22 # it won't find the bootstrap version.
24 # SEARCH_SOURCE ?= $(LOCATE_TARGET) $(DOT) ;
25 # LOCATE_SOURCE ?= $(LOCATE_TARGET) ;
28 # We have some different files for UNIX, VMS, and NT.
32 # For some really stupid reason, classic Jam doesn't define NT
33 # when compiling with Mingw, but the variable MINGW instead..
36 if ! $(NT) && $(MINGW)
38   NT = 1 ;
39   JAM_TOOLSET = MINGW ;
42 if $(NT)  { code = execunix.c filent.c pathunix.c ; }
43 else if $(OS2)
45   # special case for OS/2: when compiling with GCC/EMX, we use
46   # "fileunix.c" instead of "fileos2.c"
47   code = execunix.c pathunix.c ;
48   if $(JAM_TOOLSET) = EMX
49   {
50     CCFLAGS += -D__OS2__ ;
51     code += fileunix.c ;
52   }
53   else
54   {
55     code += fileos2.c ;
56   }
58 else if $(VMS)  { code = execvms.c filevms.c pathvms.c ; }
59 else if $(MAC)  { code = execmac.c filemac.c pathmac.c ; }
60 else    { code = execunix.c fileunix.c pathunix.c ; }
62 if $(UNIX) && $(OS) = CYGWIN
64   CCFLAGS += -D__cygwin__ ;
67 # For jam profiling/debugging.
69 if $(PROFILE)
71   CCFLAGS += -pg ;
72   LINKFLAGS += -pg ;
73   LOCATE_TARGET = $(LOCATE_TARGET)/pg ;
76 if $(DEBUG)
78   CCFLAGS += -g ;
79   LINKFLAGS += -g ;
80   LOCATE_TARGET = $(LOCATE_TARGET)/g ;
83 # We have to signal jam.h for these
85 if $(OS) = NT
87   switch $(JAM_TOOLSET)
88   {
89     case MINGW       : CCFLAGS += -DNT ;
90     case LCC         : CCFLAGS += -DNT ;
91     case DIGITALMARS : CCFLAGS += -DNT ;
92     case *           : CCFLAGS += /DNT ;
93   }
96 # Do we know yacc?
98 if $(YACC)  { code += jamgram.y ; }
99 else            { code += jamgram.c ; }
102 # Build the jamgram.y from the jamgram.yy
103 # yyacc is a slippery script that makes grammars a little
104 # easier to read/maintain.
107 if $(YACC) && $(SUFEXE) = ""
109   GenFile jamgram.y jamgramtab.h : ./yyacc jamgram.yy ;
113 # How to build the compiled in jambase.
116 Main    mkjambase : mkjambase.c ;
118 if $(VMS)
120   CC = cxx ;
121   LINK = cxxlink ;
122   CCFLAGS += /define=VMS ;
126 # The guts of the Jamfile: how to build Jam
129 Main            jam : jam.c jambase.c ;
130 LinkLibraries   jam : libjam.a ;
131 GenFile       jambase.c : mkjambase Jambase ;
133 if $(UNIX)
135   actions Strip
136   {
137     strip $(1)
138   }
140   Strip mkjambase ;
141   Strip jam ;
144 Library         libjam.a :
145         builtins.c command.c compile.c $(code) expand.c
146         glob.c hash.c headers.c lists.c make.c make1.c
147         newstr.c option.c parse.c regexp.c rules.c scan.c
148         search.c timestamp.c variable.c
149         hdrmacro.c strings.c
150         ;
152 # Strip the Jam executable on Mingw
154 if $(JAM_TOOLSET) = MINGW
156   actions  Strip
157   {
158     strip $(1)
159   }
161   Strip  jam$(SUFEXE) ;
165 if $(BINDIR)  { InstallBin $(BINDIR) : jam ; }
168 # Distribution making from here on out.
171 ALLSOURCE =
172   Build.com Build.mpw Jam.html Jambase Jambase.html Jamfile
173   Jamfile.html Porting README RELNOTES builtins.c builtins.h
174   command.c command.h compile.c compile.h execcmd.h execmac.c
175   execnt.c execunix.c execvms.c expand.c expand.h filemac.c filent.c
176   fileos2.c filesys.h fileunix.c filevms.c glob.c hash.c hash.h
177   hdrmacro.c hdrmacro.h headers.c headers.h jam.c jam.h jambase.c
178   jambase.h jamgram.c jamgram.h jamgram.y jamgram.yy jamgramtab.h
179   lists.c lists.h make.c make.h make1.c mkjambase.c newstr.c newstr.h
180   option.c option.h parse.c parse.h patchlevel.h pathmac.c pathsys.h
181   pathunix.c pathvms.c regexp.c regexp.h rules.c rules.h scan.c
182   scan.h search.c search.h timestamp.c timestamp.h variable.c variable.h
183   strings.c strings.h
184   yyacc
185   hdrmacro.c
186   INSTALL
187   README.ORG
188   CHANGES
189   common.mk
190   [ GLOB builds : *.mk ]
191   [ GLOB builds/unix : *.in ]
192   builds/unix/configure
193   builds/unix/configure.ac
194   builds/unix/config.sub
195   builds/unix/config.guess
196   builds/unix/install-sh
197   builds/unix/mkinstalldirs
198   configure
199   ;
202 rule Binary
204     NotFile  package ;
205     Depends  package : $(<) ;
207     DEPENDS $(<) : $(>) ;
209     switch $(<)
210     {
211     case *-win32.zip       : Zip-Exe  $(<) : $(>) ;
212     case *-os2.zip         : Zip-Exe  $(<) : $(>) ;
213     case *-linux-libc6.tar : GZip-Exe $(<) : $(>) ;
214     }
218 rule Package
220   NotFile package ;
221   Depends package : $(<) ;
223   DEPENDS $(<) : $(>) ;
225   switch $(<)
226   {
227   case *.tar  : { Tar-Gz  $(<) : $(>) ; Tar-Bz2 $(<) : $(>) ; }
228   case *.zip  :   Zip     $(<) : $(>) ;
229   }
233 VERSION = kjam-2.5.2 ;
235 actions Tar-Gz
237   ln -s . $(VERSION)
238   tar cvhf $(<) $(VERSION)/$(>)
239   rm -f $(VERSION)
240   gzip -9f $(<)
243 actions Tar-Bz2
245   ln -s . $(VERSION)
246   tar cvhf $(<) $(VERSION)/$(>)
247   bzip2 -9f $(<)
248   rm -f $(<)
252 if $(UNIX)
254   actions Zip
255   {
256     rm -f $(<)
257     ln -s . $(VERSION)
258     zip -9rl $(<) $(VERSION)/$(>)
259     rm -f $(VERSION)
260   }
262 else
264   actions Zip
265   {
266     $(RMF) $(<)
267     zip -9rl $(<) $(>)
268   }
272 actions Zip-Exe
274   zip -9j $(<) $(LOCATE_TARGET)\jam.exe
277 actions GZip-Exe
279   ln -s $(LOCATE_TARGET)/jam jam
280   tar chf $(<) jam
281   rm -f jam
282   gzip -9f $(<)
287 if $(NT)
289   Binary  $(VERSION)-win32.zip : $(ALLSOURCE) ;
290   Package $(VERSION).zip       : $(ALLSOURCE) ;
292 else if $(OS2)
294   Binary  $(VERSION)-os2.zip : $(ALLSOURCE) ;
295   Package $(VERSION).zip     : $(ALLSOURCE) ;
297 else if $(UNIX)
299   # how can we detect the C library version reliably ??
300   # for now, this should only be used for convenience
301   # purposes, until we add .rpm and .deb support in..
302   #
303   if $(OS) = LINUX
304   {
305     Binary $(VERSION)-linux-libc6.tar : jam ;
306   }
308   Package $(VERSION).tar : $(ALLSOURCE) ;
309   Package $(VERSION).zip : $(ALLSOURCE) ;