-
Notifications
You must be signed in to change notification settings - Fork 1
/
GNUmakefile.in
258 lines (217 loc) · 8.54 KB
/
GNUmakefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# YOU DO NOT NEED TO CONFIGURE ANYTHING IN THIS FILE.
#
# RUN THE SHELL SCRIPT ./build.MudOS to generate the Makefiles, and follow
# its instructions.
#
############################################################################
#
# **** TARGETS AND THEIR CORRECT USAGE ****
#
# COMPILATION TARGETS:
#
# all: compile all the files
#
# install: make all, then move the files to the correct directories
#
# remake: remove the object files and generated files, and recompile
# NO reconfiguration is done, etc.
#
# depend: automatically create dependency info
#
#
# 'CLEAN' TARGETS:
#
# neat: remove object files and generated files (used by remake)
#
# clean: in addition to neat, also remove .orig and .rej files,
# cores, lint files, emacs backups, tag files, yacc debug
# files, generated Makefiles, generated binaries, and
# generated dependency info
#
# spotless: make clean, then remove ALL CONFIGURATION AND CUSTOMIZATION
# useful for creating distributions
#
# ---- REALLY COMPLEX OPTIONS YOU PROBABLY DON'T WANT TO TOUCH -----
#
# NeXT: link with MallocDebug if you have a NeXT with NeXTOS 2.1 or later and
# you wish to search for memory leaks (see /NextDeveloper/Apps/MallocDebug).
# Note: linking with MallocDebug will cause the virtual size of the
# driver process to reach appoximately 40MB however the amount of real memory
# used will remain close to normal.
#EXTRALIBS=-lMallocDebug -lsys_s
#
# ---- DO NOT EDIT ANYTHING BELOW HERE UNLESS YOU KNOW ALOT ABOUT HOW
# MUDOS WORKS INTERNALLY ----
OVERRIDES=$(MAKEOVERRIDES)
# **************************************************************************
# **** NOTE: If you add something here, also add it to the OBJ= rule below,
# **** or non-GNU makes will die
# **************************************************************************
SRC=grammar.tab.c lex.c main.c rc.c interpret.c simulate.c file.c object.c \
backend.c array.c mapping.c comm.c ed.c regexp.c buffer.c crc32.c \
malloc.c mallocwrapper.c class.c efuns_main.c efuns_port.c \
call_out.c otable.c dumpstat.c stralloc.c hash.c \
port.c reclaim.c parse.c simul_efun.c sprintf.c program.c \
compiler.c avltree.c icode.c trees.c generate.c scratchpad.c \
socket_efuns.c socket_ctrl.c qsort.c eoperators.c socket_err.c md.c \
disassembler.c uvalarm.c $(STRFUNCS) \
replace_program.c master.c function.c \
debug.c crypt.c applies_table.c add_action.c eval.c fliconv.c console.c
all: $(OBJDIR) cc.h main_build
main_build2: $(DRIVER_BIN) addr_server portbind
main_build: files
$(MAKE) main_build2
VPATH = $(OBJDIR)
OBJ=$(addprefix $(OBJDIR)/,$(subst .c,.o,$(SRC)))
$(OBJDIR)/%.o: %.c
$(CC) $(CFLAGS) $(OPTIMIZE) -o $@ -c $<
$(OBJDIR)/lex.o: lex.c preprocess.c cc.h grammar.tab.c
$(OBJDIR)/grammar.tab.o: grammar.tab.c opcodes.h
$(OBJDIR):
mkdir -p $(OBJDIR)
which_makefile:
echo MakeIsGNU
grammar.tab.c: grammar.y
$(YACC) grammar.y
-rm -f grammar.tab.*
sed "s/y.tab.c/grammar.tab.c/g" y.tab.c > grammar.tab.c
-mv y.tab.h grammar.tab.h
packages/packages.a: packages/*.c
$(MAKE) -C packages 'CC=$(CC)' 'CFLAGS=$(CFLAGS) $(OPTIMIZE)' 'OBJDIR=../$(OBJDIR)' 'RANLIB=$(RANLIB)' 'A=$(A)' 'O=$(O)'
$(DRIVER_BIN): packages/packages.a $(OBJ) dtrace_compile
-mv -f $(DRIVER_BIN) $(DRIVER_BIN).old
$(PROOF) $(CC) $(CFLAGS) $(OPTIMIZE) $(OBJ) `./dtrace_compile` -o $(DRIVER_BIN) packages/packages.a $(EXTRALIBS) `cat system_libs`
dtrace_compile: dtrace_compile.c local_options
$(CC) dtrace_compile.c -o dtrace_compile
addr_server: files $(OBJDIR)/addr_server.o $(OBJDIR)/socket_ctrl.o $(OBJDIR)/port.o addr_server.h
$(CC) $(CFLAGS) $(OPTIMIZE) $(OBJDIR)/socket_ctrl.o $(OBJDIR)/addr_server.o $(OBJDIR)/port.o \
-o addr_server `cat system_libs`
portbind: $(OBJDIR)/portbind.o
$(CC) $(CFLAGS) $(OPTIMIZE) $(OBJDIR)/portbind.o -o portbind `cat system_libs`
remake: neat all
customize:
-cp ../local_options .
-cp ../system_libs .
-cp ../configure.h .
depend: opcodes.h grammar.tab.c cc.h efunctions.h efun_defs.c configure.h
-rm tmpdepend
for i in *.c; do $(CC) -MM -DDEPEND $$i >>tmpdepend; done
sed -e "s!^[^ ]!$(OBJDIR)/&!" <tmpdepend >Dependencies
-rm tmpdepend
cc.h: GNUmakefile
rm -f cc.h
echo "/* this file automatically generated by the Makefile */" > cc.h
echo '#define COMPILER "$(CC)"' >> cc.h
echo '#define OPTIMIZE "$(OPTIMIZE)"' >> cc.h
echo '#define CFLAGS "$(CFLAGS) $(OPTIMIZE)"' >> cc.h
echo '#define OBJDIR "$(OBJDIR)"' >> cc.h
# the touches here are necessary to fix the modification times; link(2) does
# 'modify' a file
files: edit_source sysmalloc.c debugmalloc.c wrappedmalloc.c options.h op_spec.c func_spec.c packages/Makefile.pre packages/GNUmakefile.pre configure.h grammar.y.pre
./edit_source -options -malloc -build_func_spec '$(CPP) $(CFLAGS)' \
-process grammar.y.pre
./edit_source -process packages/Makefile.pre
./edit_source -process packages/GNUmakefile.pre
./edit_source -build_efuns -build_applies
touch mallocwrapper.c
touch malloc.c
touch files
make_func.tab.c: make_func.y cc.h
$(YACC) $(YFLAGS) make_func.y
-rm -f make_func.tab.c
mv y.tab.c make_func.tab.c
configure.h: edit_source build.FluffOS
-if test \( ! -r configure.h \) -o \( ! -r configuration \); then \
rm -f configuration; \
touch configuration; \
fi
if test "Machine `uname -a` Configure version 5" = "`cat configuration`"; then \
echo "Skipping configuration ..."; \
else \
./edit_source -configure; \
echo "Machine `uname -a` Configure version 5" > configuration; \
fi
$(OBJDIR)/edit_source.o: edit_source.c preprocess.c cc.h
edit_source: $(OBJDIR)/edit_source.o $(OBJDIR)/hash.o $(OBJDIR)/make_func.tab.o
$(CC) $(CFLAGS) $(OBJDIR)/edit_source.o $(OBJDIR)/hash.o $(OBJDIR)/make_func.tab.o -o edit_source
# don't optimize these two
$(OBJDIR)/edit_source.o: edit_source.c
$(CC) $(CFLAGS) -o $@ -c $<
$(OBJDIR)/make_func.tab.o: make_func.tab.c
$(CC) $(CFLAGS) -o $@ -c $<
tags: $(SRC)
ctags $(SRC)
TAGS: $(SRC)
etags $(SRC)
install: all
-mkdir $(INSTALL_DIR)
$(INSTALL) $(DRIVER_BIN) $(INSTALL_DIR)
$(INSTALL) addr_server $(INSTALL_DIR)
$(INSTALL) portbind $(INSTALL_DIR)
Makefiles: Makefile.in NMakefile.in
Makefile.in: edit_source Makefile.in.pre Makefile.master
./edit_source -process Makefile.in.pre
NMakefile.in: edit_source NMakefile.in.pre Makefile.master
./edit_source -process NMakefile.in.pre
nothing:
# remove local configuration
spotless: clean
-rm -f configure.h local_options system_libs configuration
-rm -f options_incl.h
-rm -f *.diffs
-find . -name "*~" -print | xargs rm
-rm -f 1.out 2.out
# get ready for recompile
neat:
-(cd packages; $(MAKE) "A=$(A)" "O=$(O)" clean)
-rm -rf $(OBJDIR) *.$(O) *.tab.c *.tab.h
-rm -f efun_defs.c option_defs.c
-rm -f opcodes.h efunctions.h opc.h efun_protos.h
-rm -f malloc.c mallocwrapper.c
-rm -f func_spec.cpp applies.h applies_table.c files
-rm -f grammar.y comptest* a.out *.exe
-rm -f packages/Makefile packages/GNUmakefile packages/packages
# remove everything except configuration
clean: neat
-rm -f Makefile.MudOS GNUmakefile.MudOS
-rm -f cc.h edit_source
-rm -f core y.output testsuite/core testsuite/tmp/*
-rm -f testsuite/OPCPROF.* testsuite/opc.*
-rm -rf testsuite/binaries testsuite/single/swapfile.*
-rm -f testsuite/OBJ_DUMP* testsuite/test_file testsuite/testfile
-rm -f testsuite/tmp_eval_file.c testsuite/sf.o testsuite/ed_test
-rm -f testsuite/log/log testsuite/log/debug.log testsuite/log/compile
-find . -name "*~" -print | xargs rm
-find . -name "*.orig" -print | xargs rm
-find . -name "*.rej" -print | xargs rm
-rm -f *.ln tags TAGS
-rm -f $(DRIVER_BIN) $(DRIVER_BIN).old addr_server portbind *.exe
-rm -f Dependencies tmpdepend
-touch Dependencies
# remove everything
distclean: neat
-rm -f Makefile.MudOS GNUmakefile.MudOS
-rm -f cc.h edit_source
-rm -f core y.output testsuite/core testsuite/tmp/*
-rm -f testsuite/OPCPROF.* testsuite/opc.*
-rm -rf testsuite/binaries testsuite/single/swapfile.*
-rm -f testsuite/OBJ_DUMP* testsuite/test_file testsuite/testfile
-rm -f testsuite/tmp_eval_file.c testsuite/sf.o testsuite/ed_test
-rm -f testsuite/log/log testsuite/log/debug.log testsuite/log/compile
-find . -name "*~" -print | xargs rm
-find . -name "*.orig" -print | xargs rm
-find . -name "*.rej" -print | xargs rm
-rm -f *.ln tags TAGS
-rm -f $(DRIVER_BIN) $(DRIVER_BIN).old addr_server portbind
-rm -f *.exe
-rm -f configure.h system_libs options_incl.h insttest configuration
-rm -f 1.out 2.out
-rm -f local_options
-rm -f dtrace_compile
-rm -f trash_me.bat trash_me.err
-cp -f GNUmakefile.in GNUmakefile
-rm -f Dependencies tmpdepend
-rm -f semantic* packages/semantic*
-rm -rf tmp
-touch Dependencies
include Dependencies