1: #Makefile for the C part of Gforth
2:
3: #Copyright (C) 1995,1996,1997,1998,2000,2003,2006,2007,2008,2009,2011 Free Software Foundation, Inc.
4:
5: #This file is part of Gforth.
6:
7: #Gforth is free software; you can redistribute it and/or
8: #modify it under the terms of the GNU General Public License
9: #as published by the Free Software Foundation, either version 3
10: #of the License, or (at your option) any later version.
11:
12: #This program is distributed in the hope that it will be useful,
13: #but WITHOUT ANY WARRANTY; without even the implied warranty of
14: #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.#See the
15: #GNU General Public License for more details.
16:
17: #You should have received a copy of the GNU General Public License
18: #along with this program. If not, see http://www.gnu.org/licenses/.
19:
20: # ------------- gforth version
21:
22: VERSION =@PACKAGE_VERSION@
23: DOSVERSION=`echo $VERSION|sed 's/\.//g'`
24: EXE=@EXEEXT@
25:
26: # ------------- System specific variables
27:
28: machine=@machine@
29: kernel_fi = @kernel_fi@
30: include_fi = @include_fi@
31: # this is the type of machine
32: # used to extend the include path with ./arch/$machine
33: # so we could include a machine specific
34: # machine.h file
35:
36: PATHSEP = @PATHSEP@
37:
38: EC = @EC@
39: ARCH= @ARCH@
40:
41: # ------------- Utility programs
42:
43: SHELL = /bin/sh
44: RM = rm
45: RMTREE = rm -rf
46: CP = cp -p
47: TAR = tar cf -
48: GCC = @CC@
49: BOOTFORTH = ../preforth
50: CC = $(GCC)
51: LD = $(GCC:gcc=ld)
52: AS = $(GCC:gcc=as)
53: STRIP = strip
54: GCCLD = @GCC_LD@
55:
56: FORTHPATH = .$(PATHSEP)$(libdir)/gforth/site-forth$(PATHSEP)$(datadir)/gforth/site-forth$(PATHSEP)$(libdir)/gforth$(ARCH)/$(VERSION)$(PATHSEP)$(datadir)/gforth/$(VERSION)
57:
58: # ------------ Source and Build directories
59:
60: top_srcdir = @top_srcdir@
61: top_builddir = @top_builddir@
62:
63: # ------------ Install directories
64:
65: VPATH = @srcdir@
66: prefix = @prefix@
67: exec_prefix = @exec_prefix@
68: srcdir = @srcdir@
69: bindir = @bindir@
70: #read-only architecture-independent files
71: datadir = @datadir@
72: #read-only architecture-dependent non-ascii files
73: libdir = @libdir@
74: infodir = @infodir@
75: mandir = @mandir@
76: man1dir= $(mandir)/man1
77: man1ext= .1
78:
79: # ------------- ltdl variables
80:
81: LTDLDEPS = @LTDLDEPS@
82: LTDLINCL = @LTDLINCL@
83: LIBLTDL = @LIBLTDL@
84:
85: # ------------- Compiler Flags
86:
87: XCFLAGS = @CFLAGS@
88: XDEFINES = @DEFS@
89: SWITCHES = $(XCFLAGS) $(XDEFINES) $(OPTDEFINES)
90: #use -fno-inline to avoid register problems with asinh, atanh on gcc-3.3 on 386
91: ENGINE_FLAGS = @ENGINE_FLAGS@ -fno-defer-pop -fcaller-saves -fno-inline
92: DEBUGFLAG = @DEBUGFLAG@
93: CFLAGS = $(DEBUGFLAG) -I$(srcdir)/../arch/$(machine) -I. -Wall $(SWITCHES) -DDEFAULTPATH='"$(FORTHPATH)"' $(LTDLINCL)
94: CPPFLAGS=@CPPFLAGS@
95: FORTHKFLAGS= --die-on-signal -p "..$(PATHSEP)$(srcdir)" -i ../$(kernel_fi)
96: FORTHK = ../gforth $(FORTHKFLAGS)
97: FORTH = $(BOOTFORTH) --die-on-signal
98:
99: #John Wavrik should use -Xlinker -N to get a writable text (executable)
100: XLDFLAGS = @LDFLAGS@
101: LDFLAGS = $(DEBUGFLAG) $(XLDFLAGS)
102: LDLIBS = @LIBS@ @LTDL_LDLIBS@
103:
104: AOBJECTS = @signals_o@ support$(OPT).o @LIBOBJS@ $(OPTOBJECTS)
105:
106: @MAKEINC@
107:
108: OBJECTS = engine$(OPT).o @engine2@ main$(OPT).o
109: OBJECTS_NATIVE = engine-native$(OPT).o engine-native2$(OPT).o engine-native3$(OPT).o main-native$(OPT).o
110: OBJECTS_FAST = engine-fast$(OPT).o @engine_fast2@ main-fast$(OPT).o
111: OBJECTS_ITC = engine-itc$(OPT).o main-itc$(OPT).o
112: OBJECTS_DITC = engine-ditc$(OPT).o main-ditc$(OPT).o
113: OBJECTS_PROF = engine-prof$(OPT).o main-prof$(OPT).o
114: OBJECTS_FI = engine$(OPT).o main-fi$(OPT).o
115:
116: # In engine subdirectory there are (or should be) only files that belong to
117: # our engine, so we can make life easy
118: DEPS = config.h forth.h io.h $(srcdir)/../arch/$(machine)/*.[h]
119: ENGINE_DEPS = engine.c $(DEPS) prim_lab.i prim.i @image_i@ fnmatch.h threaded.h
120: MAIN_DEPS = main.c $(DEPS) prim_superend.i prim_num.i prim_grp.i costs.i super2.i
121: ENGINE_FAST_DEPS = engine.c $(DEPS) prim_lab-fast.i prim-fast.i fnmatch.h threaded.h
122: MAIN_FAST_DEPS = main.c $(DEPS) prim_superend-fast.i prim_num-fast.i prim_grp-fast.i costs-fast.i super2-fast.i
123:
124: COMPILE.c = $(GCC) $(CFLAGS) $(CPPFLAGS) -c # simulate BSD sys.mk
125:
126: #some makes don't do the -o $@ correctly, so we help them
127: .c.o:
128: $(COMPILE.c) -o $@ $<
129:
130: .s.o:
131: $(COMPILE.c) -o $@ $<
132:
133: support$(OPT).o: support.c config.h forth.h longlong.h
134: $(COMPILE.c) -o $@ $(srcdir)/support.c
135:
136: strtol.o: strtol.c ansidecl.h
137:
138: fnmatch.o: fnmatch.c fnmatch.h
139:
140: getopt1.o: getopt1.c getopt.h
141:
142: getopt.o: getopt.c getopt.h
143:
144: gforth$(OPT)$(EC)$(ARCH)$(EXE): $(OBJECTS) $(AOBJECTS) $(LTDLDEPS)
145: $(GCCLD) $(LDFLAGS) $(OBJECTS) $(AOBJECTS) $(LDLIBS) -o $@
146:
147: gforth-native$(OPT)$(EC)$(ARCH)$(EXE): $(OBJECTS_NATIVE) $(AOBJECTS) $(LTDLDEPS)
148: $(GCCLD) $(LDFLAGS) $(OBJECTS_NATIVE) $(AOBJECTS) $(LDLIBS) -o $@
149:
150: gforth-fast$(OPT)$(EC)$(ARCH)$(EXE): $(OBJECTS_FAST) $(AOBJECTS) $(LTDLDEPS)
151: $(GCCLD) $(LDFLAGS) $(OBJECTS_FAST) $(AOBJECTS) $(LDLIBS) -o $@
152:
153: gforth-itc$(OPT)$(EC)$(ARCH)$(EXE): $(OBJECTS_ITC) $(AOBJECTS) $(LTDLDEPS)
154: $(GCCLD) $(LDFLAGS) $(OBJECTS_ITC) $(AOBJECTS) $(LDLIBS) -o $@
155:
156: gforth-ditc$(OPT)$(EC)$(ARCH)$(EXE): $(OBJECTS_DITC) $(AOBJECTS) $(LTDLDEPS)
157: $(GCCLD) $(LDFLAGS) $(OBJECTS_DITC) $(AOBJECTS) $(LDLIBS) -o $@
158:
159: gforth-prof$(OPT)$(EC)$(ARCH)$(EXE): $(OBJECTS_PROF) $(AOBJECTS) $(LTDLDEPS) profile$(OPT).o
160: $(GCCLD) $(LDFLAGS) $(OBJECTS_PROF) $(AOBJECTS) profile$(OPT).o $(LDLIBS) -o $@
161:
162: gforth-fi$(OPT)$(EC)$(ARCH)$(EXE): $(OBJECTS_FI) $(AOBJECTS) $(LTDLDEPS)
163: $(GCCLD) $(LDFLAGS) $(OBJECTS_FI) $(AOBJECTS) $(LDLIBS) -o $@
164:
165: engine.s: $(ENGINE_FAST_DEPS)
166: $(GCC) $(CFLAGS) $(CPPFLAGS) $(ENGINE_FLAGS) -S $(srcdir)/engine.c
167:
168: engine$(OPT).o: $(ENGINE_DEPS)
169: $(COMPILE.c) $(ENGINE_FLAGS) -DGFORTH_DEBUGGING -o $@ $(srcdir)/engine.c
170:
171: engine2$(OPT).o: $(ENGINE_DEPS)
172: $(COMPILE.c) $(ENGINE_FLAGS) -DGFORTH_DEBUGGING -DENGINE=2 -o $@ $(srcdir)/engine.c
173:
174: engine-native$(OPT).o:$(ENGINE_FAST_DEPS)
175: $(COMPILE.c) $(ENGINE_FLAGS) -DNO_IP -o $@ $(srcdir)/engine.c
176:
177: engine-native2$(OPT).o:$(ENGINE_FAST_DEPS)
178: $(COMPILE.c) $(ENGINE_FLAGS) -DNO_IP -DENGINE=2 -o $@ $(srcdir)/engine.c
179:
180: engine-native3$(OPT).o:$(ENGINE_FAST_DEPS)
181: $(COMPILE.c) $(ENGINE_FLAGS) -DNO_IP -DENGINE=3 -o $@ $(srcdir)/engine.c
182:
183: engine-fast$(OPT).o: $(ENGINE_FAST_DEPS)
184: $(COMPILE.c) $(ENGINE_FLAGS) -o $@ $(srcdir)/engine.c
185:
186: engine-fast2$(OPT).o: $(ENGINE_FAST_DEPS)
187: $(COMPILE.c) $(ENGINE_FLAGS) -DENGINE=2 -o $@ $(srcdir)/engine.c
188:
189: engine-itc$(OPT).o: $(ENGINE_DEPS)
190: $(COMPILE.c) $(ENGINE_FLAGS) -DINDIRECT_THREADED -DGFORTH_DEBUGGING -o $@ $(srcdir)/engine.c
191:
192: engine-ditc$(OPT).o: $(ENGINE_DEPS)
193: $(COMPILE.c) $(ENGINE_FLAGS) -DDOUBLY_INDIRECT -o $@ $(srcdir)/engine.c
194:
195: engine-prof$(OPT).o: $(ENGINE_DEPS)
196: $(COMPILE.c) $(ENGINE_FLAGS) -DVM_PROFILING -o $@ $(srcdir)/engine.c
197:
198: main$(OPT).o: $(MAIN_DEPS)
199: $(COMPILE.c) -DGFORTH_DEBUGGING @no_dynamic@ -o $@ $(srcdir)/main.c
200:
201: main-native$(OPT).o: $(MAIN_FAST_DEPS)
202: $(COMPILE.c) -DNO_IP -o $@ $(srcdir)/main.c
203:
204: main-fast$(OPT).o: $(MAIN_FAST_DEPS)
205: $(COMPILE.c) -o $@ $(srcdir)/main.c
206:
207: main-itc$(OPT).o: $(MAIN_DEPS)
208: $(COMPILE.c) -DINDIRECT_THREADED -DGFORTH_DEBUGGING -o $@ $(srcdir)/main.c
209:
210: main-ditc$(OPT).o: $(MAIN_DEPS)
211: $(COMPILE.c) -DDOUBLY_INDIRECT -o $@ $(srcdir)/main.c
212:
213: main-prof$(OPT).o: $(MAIN_DEPS)
214: $(COMPILE.c) -DVM_PROFILING -o $@ $(srcdir)/main.c
215:
216: main-fi$(OPT).o: $(MAIN_DEPS)
217: $(COMPILE.c) -DINCLUDE_IMAGE -o $@ $(srcdir)/main.c
218:
219: peephole$(OPT).o: peephole.c peephole.i $(DEPS)
220: $(COMPILE.c) -o $@ $(srcdir)/peephole.c
221:
222: profile$(OPT).o: profile.c profile.i $(DEPS)
223: $(COMPILE.c) -o $@ $(srcdir)/profile.c
224:
225: #The next two rules seem to be superfluous:
226:
227: # engine: $(OBJECTS) $(OBJECTS0) ;
228:
229: # engine_ditc: $(OBJECTS_DITC) $(OBJECTS0) ;
230:
231: #NeXTstep hack
232:
233: termios.o: /usr/lib/libposix.a
234: ar x /usr/lib/libposix.a termios.o
235:
236: config.h: stamp-h
237: stamp-h: config.h.in ../config.status ../stamp-h.in
238: cd .. && CONFIG_FILES=$@ CONFIG_HEADERS=engine/config.h ./config.status
239: echo timestamp > stamp-h
240:
241: Makefile: Makefile.in ../config.status ../configure.in
242: cd .. && $(MAKE) engine/Makefile.in
243:
244: image.i: ../fi2c.fs ../$(include_fi)
245: $(BOOTFORTH) ../fi2c.fs -e "s\" ../$(include_fi)\" fi2c bye" >$@
246:
247: ../$(include_fi): FORCE
248: cd .. && $(MAKE) $(include_fi)
249:
250: #phony targets depend on FORCE; this is more portable than .PHONY
251: FORCE:
252:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>