1: #Makefile for the C part of Gforth
2:
3: #Copyright (C) 1995,1996,1997,1998,2000,2003,2006,2007 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: osclass = @OSCLASS@
39:
40: EC = @EC@
41:
42: # ------------- Utility programs
43:
44: SHELL = /bin/sh
45: RM = rm
46: RMTREE = rm -rf
47: CP = cp -p
48: TAR = tar cf -
49: GCC = @CC@
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/$(VERSION)$(PATHSEP)$(datadir)/gforth/$(VERSION)
57:
58: # ------------ Install Directorys
59:
60: VPATH = @srcdir@
61: prefix = @prefix@
62: exec_prefix = @exec_prefix@
63: srcdir = @srcdir@
64: bindir = $(exec_prefix)/bin
65: #read-only architecture-independent files
66: datadir = $(prefix)/share
67: #read-only architecture-dependent non-ascii files
68: libdir = $(prefix)/lib
69: infodir = $(prefix)/info
70: mandir = $(prefix)/man
71: man1dir= $(mandir)/man1
72: man1ext= .1
73:
74: # ------------- Compiler Flags
75:
76: XCFLAGS = @CFLAGS@
77: XDEFINES = @DEFS@
78: SWITCHES = $(XCFLAGS) $(XDEFINES)
79: #use -fno-inline to avoid register problems with asinh, atanh on gcc-3.3 on 386
80: ENGINE_FLAGS = @ENGINE_FLAGS@ -fno-defer-pop -fcaller-saves -fno-inline
81: DEBUGFLAG = @DEBUGFLAG@
82: CFLAGS = $(DEBUGFLAG) -I$(srcdir)/../arch/$(machine) -I. -Wall $(SWITCHES) -DDEFAULTPATH='"$(FORTHPATH)"'
83: CFLAGS2 = $(DEBUGFLAG) -I$(srcdir)/../arch/$(machine) -I. -Wall $(SWITCHES) -DDEFAULTPATH='"$(FORTHPATH)"'
84: FORTHKFLAGS= --die-on-signal -p "..$(PATHSEP)$(srcdir)" -i ../$(kernel_fi)
85: FORTHK = ../gforth $(FORTHKFLAGS)
86: FORTH = ../gforth --die-on-signal -p "..$(PATHSEP)$(srcdir)" -i ../gforth.fi
87:
88: #John Wavrik should use -Xlinker -N to get a writable text (executable)
89: XLDFLAGS = @LDFLAGS@
90: LDFLAGS = $(DEBUGFLAG) $(XLDFLAGS)
91: LDLIBS = @LIBS@
92:
93: AOBJECTS = @signals_o@ support.o @LIBOBJS@
94:
95: @MAKEINC@
96:
97: OBJECTS = engine.o @engine2@ main.o
98: OBJECTS_NATIVE = engine-native.o engine-native2.o engine-native3.o main-native.o
99: OBJECTS_FAST = engine-fast.o @engine_fast2@ main-fast.o
100: OBJECTS_ITC = engine-itc.o main-itc.o
101: OBJECTS_DITC = engine-ditc.o main-ditc.o
102: OBJECTS_PROF = engine-prof.o main-prof.o
103: OBJECTS_FI = engine.o main-fi.o
104:
105: # In engine subdirectory there are (or should be) only files that belong to
106: # our engine, so we can make life easy
107: DEPS = config.h forth.h io.h $(srcdir)/../arch/$(machine)/*.[h]
108: ENGINE_DEPS = engine.c $(DEPS) prim_lab.i prim.i @image_i@ fnmatch.h threaded.h
109: MAIN_DEPS = main.c $(DEPS) prim_superend.i prim_num.i prim_grp.i costs.i super2.i
110: ENGINE_FAST_DEPS = engine.c $(DEPS) prim_lab-fast.i prim-fast.i fnmatch.h threaded.h
111: MAIN_FAST_DEPS = main.c $(DEPS) prim_superend-fast.i prim_num-fast.i prim_grp-fast.i costs-fast.i super2-fast.i
112:
113: #some makes don't do the -o $@ correctly, so we help them
114: .c.o:
115: $(GCC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
116:
117: .s.o:
118: $(GCC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
119:
120: support.o: support.c config.h forth.h longlong.h
121:
122: strtol.o: strtol.c ansidecl.h
123:
124: fnmatch.o: fnmatch.c fnmatch.h
125:
126: getopt1.o: getopt1.c getopt.h
127:
128: getopt.o: getopt.c getopt.h
129:
130: gforth$(EC)$(EXE): $(OBJECTS) $(AOBJECTS)
131: $(GCCLD) $(LDFLAGS) $(OBJECTS) $(AOBJECTS) $(LDLIBS) -o $@
132:
133: gforth-native$(EC)$(EXE): $(OBJECTS_NATIVE) $(AOBJECTS)
134: $(GCCLD) $(LDFLAGS) $(OBJECTS_NATIVE) $(AOBJECTS) $(LDLIBS) -o $@
135:
136: gforth-fast$(EC)$(EXE): $(OBJECTS_FAST) $(AOBJECTS)
137: $(GCCLD) $(LDFLAGS) $(OBJECTS_FAST) $(AOBJECTS) $(LDLIBS) -o $@
138:
139: gforth-itc$(EC)$(EXE): $(OBJECTS_ITC) $(AOBJECTS)
140: $(GCCLD) $(LDFLAGS) $(OBJECTS_ITC) $(AOBJECTS) $(LDLIBS) -o $@
141:
142: gforth-ditc$(EC)$(EXE): $(OBJECTS_DITC) $(AOBJECTS)
143: $(GCCLD) $(LDFLAGS) $(OBJECTS_DITC) $(AOBJECTS) $(LDLIBS) -o $@
144:
145: gforth-prof$(EC)$(EXE): $(OBJECTS_PROF) $(AOBJECTS) profile.o
146: $(GCCLD) $(LDFLAGS) $(OBJECTS_PROF) $(AOBJECTS) profile.o $(LDLIBS) -o $@
147:
148: gforth-fi$(EC)$(EXE): $(OBJECTS_FI) $(AOBJECTS)
149: $(GCCLD) $(LDFLAGS) $(OBJECTS_FI) $(AOBJECTS) $(LDLIBS) -o $@
150:
151: engine.s: $(ENGINE_FAST_DEPS)
152: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -S $(srcdir)/engine.c
153:
154: engine.o: $(ENGINE_DEPS)
155: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/engine.c
156:
157: engine2.o: $(ENGINE_DEPS)
158: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DGFORTH_DEBUGGING -DENGINE=2 -o $@ -c $(srcdir)/engine.c
159:
160: engine-native.o:$(ENGINE_FAST_DEPS)
161: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -o $@ -c $(srcdir)/engine.c
162:
163: engine-native2.o:$(ENGINE_FAST_DEPS)
164: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -DENGINE=2 -o $@ -c $(srcdir)/engine.c
165:
166: engine-native3.o:$(ENGINE_FAST_DEPS)
167: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DNO_IP -DENGINE=3 -o $@ -c $(srcdir)/engine.c
168:
169: engine-fast.o: $(ENGINE_FAST_DEPS)
170: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -o $@ -c $(srcdir)/engine.c
171:
172: engine-fast2.o: $(ENGINE_FAST_DEPS)
173: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DENGINE=2 -o $@ -c $(srcdir)/engine.c
174:
175: engine-itc.o: $(ENGINE_DEPS)
176: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DINDIRECT_THREADED -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/engine.c
177:
178: engine-ditc.o: $(ENGINE_DEPS)
179: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DDOUBLY_INDIRECT -o $@ -c $(srcdir)/engine.c
180:
181: engine-prof.o: $(ENGINE_DEPS)
182: $(GCC) $(CFLAGS2) $(ENGINE_FLAGS) -DVM_PROFILING -o $@ -c $(srcdir)/engine.c
183:
184: main.o: $(MAIN_DEPS)
185: $(GCC) $(CFLAGS) -DGFORTH_DEBUGGING @no_dynamic@ -o $@ -c $(srcdir)/main.c
186:
187: main-native.o: $(MAIN_FAST_DEPS)
188: $(GCC) $(CFLAGS) -DNO_IP -o $@ -c $(srcdir)/main.c
189:
190: main-fast.o: $(MAIN_FAST_DEPS)
191: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/main.c
192:
193: main-itc.o: $(MAIN_DEPS)
194: $(GCC) $(CFLAGS) -DINDIRECT_THREADED -DGFORTH_DEBUGGING -o $@ -c $(srcdir)/main.c
195:
196: main-ditc.o: $(MAIN_DEPS)
197: $(GCC) $(CFLAGS) -DDOUBLY_INDIRECT -o $@ -c $(srcdir)/main.c
198:
199: main-prof.o: $(MAIN_DEPS)
200: $(GCC) $(CFLAGS) -DVM_PROFILING -o $@ -c $(srcdir)/main.c
201:
202: main-fi.o: $(MAIN_DEPS)
203: $(GCC) $(CFLAGS) -DINCLUDE_IMAGE -o $@ -c $(srcdir)/main.c
204:
205: peephole.o: peephole.c peephole.i $(DEPS)
206: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/peephole.c
207:
208: profile.o: profile.c profile.i $(DEPS)
209: $(GCC) $(CFLAGS) -o $@ -c $(srcdir)/profile.c
210:
211: #The next two rules seem to be superfluous:
212:
213: # engine: $(OBJECTS) $(OBJECTS0) ;
214:
215: # engine_ditc: $(OBJECTS_DITC) $(OBJECTS0) ;
216:
217: #NeXTstep hack
218:
219: termios.o: /usr/lib/libposix.a
220: ar x /usr/lib/libposix.a termios.o
221:
222: #duplicated rules to avoid too many recursive make invocations
223: # !! No any forth stuff should be done in ../Makefile.
224: # !! I added the dependencies on prim.i and prim_lab.i in the main Makefile, jens
225:
226: #I commented out the following rules because they are no longer up-to-date. - anton
227:
228: #prim.i: ../prim.b ../prims2x.fs
229: # $(FORTHK) prims2x.fs -e "s\" ../prim.b\" ' output-c process-file bye" >$@-
230: # $(CP) $@- $@
231: # $(RM) $@-
232: #
233: #prim_lab.i: ../prim.b ../prims2x.fs
234: # $(FORTHK) prims2x.fs -e "s\" ../prim.b\" ' output-label process-file bye" >$@-
235: # $(CP) $@- $@
236: # $(RM) $@-
237:
238: config.h: stamp-h
239: stamp-h: config.h.in ../config.status ../stamp-h.in
240: cd .. && CONFIG_FILES=$@ CONFIG_HEADERS=engine/config.h ./config.status
241: echo timestamp > stamp-h
242:
243: image.i: ../fi2c.fs ../$(include_fi)
244: $(FORTH) fi2c.fs -e "s\" ../$(include_fi)\" fi2c bye" >$@
245:
246: ../$(include_fi): FORCE
247: cd .. && $(MAKE) $(include_fi)
248:
249: #phony targets depend on FORCE; this is more portable than .PHONY
250: FORCE:
251:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>