-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile.in
executable file
·309 lines (223 loc) · 7.18 KB
/
Makefile.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
DEBUG = # -g
srcdir = ./src
build = ./build
ext = ./ext
contrib = ./contrib
utils = $(srcdir)/utils
parser = $(srcdir)/parser
core = $(srcdir)/newt_core
objdir = $(build)/obj
yytmp = $(objdir)/yytmp
tardir = $(shell basename `pwd`)_$(shell uname)
docdir = $(build)/html
headerdir = $(core)/incs
DESTROOT =
CC = @CC@
YACC = @YACC@ -d
LEX = @LEX@
DEFS = @DEFS@
LIBS = @LIBS@
DLEXT = @DLEXT@
EXEEXT = @EXEEXT@
LDIMPORT = @NEWT_LDIMPORT@
LDFLAGS = $(DEBUG) -O2 @LDFLAGS@ @NEWT_LDFLAGS@
LDSHARED = @LIBNEWT_LDSHARED@
# declarations needed to creat a static library
LIBCOMMAND = @LIBCOMMAND@
LIBEXT = @LIBEXT@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sitedir = ${prefix}/lib/newt0
includedir = @includedir@/newt0
libdir = ${prefix}/lib
VPATH = $(core)
STRIP = strip -x
CFLAGS = $(DEBUG) $(DEFS) @NEWT_CFLAGS@ -O2 -pipe
CPPFLAGS = -I. -I$(srcdir) -I$(core)/incs -I$(srcdir)/parser -I$(yytmp) @CPPFLAGS@
NEWT = $(build)/newt$(EXEEXT)
LIBNEWT = $(build)/libnewt$(LIBEXT)
MAINOBJ = $(objdir)/main.o
UTILSOBJS = $(objdir)/endian_utils.o
COREOBJS = $(objdir)/NewtBC.o \
$(objdir)/NewtEnv.o \
$(objdir)/NewtFile.o \
$(objdir)/NewtFns.o \
$(objdir)/NewtGC.o \
$(objdir)/NewtIconv.o \
$(objdir)/NewtIO.o \
$(objdir)/NewtMem.o \
$(objdir)/NewtNSOF.o \
$(objdir)/NewtPkg.o \
$(objdir)/NewtObj.o \
$(objdir)/NewtParser.o \
$(objdir)/NewtPrint.o \
$(objdir)/NewtStr.o \
$(objdir)/NewtVM.o
PARSEROBJS = $(yytmp)/y.tab.o \
$(yytmp)/lex.yy.o \
$(objdir)/lookup_words.o
NEWTLIBS = $(ext)/protoFILE \
$(ext)/protoREGEX
CONTRIBLIBS = $(contrib)/inwt
CONTRIBLIBS_OBJC = $(contrib)/NewtObjC
CONTRIBLIBS_LIBFFI = $(contrib)/NativeCalls
OBJS = $(MAINOBJ) $(UTILSOBJS) $(PARSEROBJS) $(COREOBJS)
LIBOBJS = $(UTILSOBJS) $(PARSEROBJS) $(COREOBJS)
HEADERS = $(headerdir)/NewtBC.h \
$(headerdir)/NewtConf.h \
$(headerdir)/NewtCore.h \
$(headerdir)/NewtEnv.h \
$(headerdir)/NewtErrs.h \
$(headerdir)/NewtFile.h \
$(headerdir)/NewtFns.h \
$(headerdir)/NewtGC.h \
$(headerdir)/NewtIconv.h \
$(headerdir)/NewtIO.h \
$(headerdir)/NewtLib.h \
$(headerdir)/NewtMem.h \
$(headerdir)/NewtNSOF.h \
$(headerdir)/NewtObj.h \
$(headerdir)/NewtParser.h \
$(headerdir)/NewtPkg.h \
$(headerdir)/NewtPrint.h \
$(headerdir)/NewtStr.h \
$(headerdir)/NewtType.h \
$(headerdir)/NewtVM.h \
$(headerdir)/platform.h \
$(srcdir)/config.h
######
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
### all
all: newt libnewt @MAKE_EXT@ @MAKE_CONTRIB@ @MAKE_CONTRIB_OBJC@ @MAKE_CONTRIB_LIBFFI@
### make directory
$(build):
mkdir -p $@
@LINK_NEWT_APP_@
$(objdir):
mkdir -p $@
$(yytmp):
mkdir -p $@
### newt
newt: $(build) $(objdir) $(yytmp) $(NEWT) $(LDIMPORT)
$(NEWT): $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) $(LIBS)
### LIBNEWT static library
libnewt: $(build) $(objdir) $(yytmp) $(LIBNEWT) $(LDIMPORT)
$(LIBNEWT): $(LIBOBJS)
$(LIBCOMMAND) $@ $(LIBOBJS)
### MAIN
$(MAINOBJ): $(srcdir)/main.c $(srcdir)/version.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/main.c
### UTILITIES
$(objdir)/endian_utils.o: $(utils)/endian_utils.c $(utils)/endian_utils.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(utils)/endian_utils.c
### PARSER
$(yytmp)/y.tab.c $(yytmp)/y.tab.h: $(parser)/newt.y
$(YACC) -o $@ $(parser)/newt.y
$(yytmp)/lex.yy.c: $(parser)/newt.l $(yytmp)/y.tab.h
$(LEX) -o$@ $(parser)/newt.l
$(objdir)/lookup_words.o: $(parser)/lookup_words.c $(parser)/lookup_words.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(parser)/lookup_words.c
### CORE
$(COREOBJS)::
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(core)/$(*F).c
### ext
ext: $(NEWTLIBS)
$(NEWTLIBS)::
$(MAKE) -C $@
contrib_objc: $(CONTRIBLIBS_OBJC)
contrib_libffi: $(CONTRIBLIBS_LIBFFI)
contrib: $(CONTRIBLIBS)
$(CONTRIBLIBS_OBJC)::
$(MAKE) -C $@
$(CONTRIBLIBS_LIBFFI)::
$(MAKE) -C $@
$(CONTRIBLIBS)::
$(MAKE) -C $@
### strip (for win)
strip:
$(STRIP) $(NEWT) $(build)/*.$(DLEXT)
### ARCHIVE
copy:
rm -rf $(build)/$(tardir)
mkdir -p $(build)/$(tardir)
cp $(NEWT) $(build)/$(tardir)
cp $(build)/*.$(DLEXT) $(build)/$(tardir)
cp -Rp COPYING README.* documents sample $(build)/$(tardir)
tgz: copy
tar czf $(build)/$(tardir).tgz -C $(build) $(tardir)
### DOCUMENT GENERATE
doc:
rm -rf $(docdir)
mkdir -p $(docdir)
cd misc; doxygen doxygen.conf
### INSTALL
.PHONY : install install_ext install_contrib install_contrib_objc install_contrib_libffi
install_ext::
@for subdir in $(NEWTLIBS); do \
(cd $$subdir && $(MAKE) install) || exit 1; \
done
install_contrib::
@for subdir in $(CONTRIBLIBS); do \
(cd $$subdir && $(MAKE) install) || exit 1; \
done
install_contrib_libffi::
@for subdir in $(CONTRIBLIBS_LIBFFI); do \
(cd $$subdir && $(MAKE) install) || exit 1; \
done
install_contrib_objc::
@for subdir in $(CONTRIBLIBS_OBJC); do \
(cd $$subdir && $(MAKE) install) || exit 1; \
done
install::
install -m 755 $(NEWT) $(DESTDIR)$(bindir)
install -m 644 $(LIBNEWT) $(DESTDIR)$(libdir)
install -d -m 755 $(DESTDIR)$(sitedir)
install -d -m 755 $(DESTDIR)$(includedir)
install -m 644 $(HEADERS) $(DESTDIR)$(includedir)
test "x@MAKE_EXT@" = x || $(MAKE) install_ext
test "x@MAKE_CONTRIB@" = x || $(MAKE) install_contrib
test "x@MAKE_CONTRIB_LIBFFI@" = x || $(MAKE) install_contrib_libffi
test "x@MAKE_CONTRIB_OBJC@" = x || $(MAKE) install_contrib_objc
### TEST
test_contrib::
@for subdir in $(CONTRIBLIBS); do \
(cd $$subdir && $(MAKE) test NEWT=$(PWD)/$(NEWT)) || exit 1; \
done
test_contrib_libffi::
@for subdir in $(CONTRIBLIBS_LIBFFI); do \
(cd $$subdir && $(MAKE) test NEWT=$(PWD)/$(NEWT)) || exit 1; \
done
test_contrib_objc::
@for subdir in $(CONTRIBLIBS_OBJC); do \
(cd $$subdir && $(MAKE) test NEWT=$(PWD)/$(NEWT)) || exit 1; \
done
test:
$(NEWT) -C tests test_arithmetic.newt
$(NEWT) -C tests test_compile.newt
$(NEWT) -C tests test_exceptions.newt
test "x@MAKE_CONTRIB@" = x || $(MAKE) test_contrib
test "x@MAKE_CONTRIB_LIBFFI@" = x || $(MAKE) test_contrib_libffi
test "x@MAKE_CONTRIB_OBJC@" = x || $(MAKE) test_contrib_objc
test "x@MAKE_EXT@" = x || $(NEWT) -C tests test_protoFILE.newt
test "x@MAKE_EXT@" = x || $(NEWT) -C tests test_protoREGEX.newt
### CLEAN
clean_contrib::
@for subdir in $(CONTRIBLIBS); do \
(cd $$subdir && $(MAKE) clean) || exit 1; \
done
clean_contrib_libffi::
@for subdir in $(CONTRIBLIBS_LIBFFI); do \
(cd $$subdir && $(MAKE) clean) || exit 1; \
done
clean_contrib_objc::
@for subdir in $(CONTRIBLIBS_OBJC); do \
(cd $$subdir && $(MAKE) clean) || exit 1; \
done
clean:
rm -rf build/*
test "x@MAKE_CONTRIB@" = x || $(MAKE) clean_contrib
test "x@MAKE_CONTRIB_LIBFFI@" = x || $(MAKE) clean_contrib_libffi
test "x@MAKE_CONTRIB_OBJC@" = x || $(MAKE) clean_contrib_objc