4 BINDIR := $(PREFIX)/bin
5 DATADIR := $(PREFIX)/share
6 MANDIR := $(DATADIR)/man
8 UNAME ?= $(shell uname)
9 CYGWIN = $(findstring CYGWIN, $(UNAME))
10 MINGW = $(findstring MINGW32, $(UNAME))
13 # linker flags and optional additional libraries if required
17 CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
18 ifneq ($(shell git describe --always 2>/dev/null),)
19 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
21 #turn on tons of warnings if clang is present
22 # but also turn off the STUPID ONES
27 -Wno-format-nonliteral \
28 -Wno-disabled-macro-expansion \
30 -Wno-missing-prototypes \
32 -Wno-missing-variable-declarations \
33 -Wno-unknown-warning-option
35 #Tiny C Compiler doesn't know what -pedantic-errors is
36 # and instead of ignoring .. just errors.
38 CFLAGS +=-pedantic-errors -ffunction-sections -fdata-sections -Wl,-gc-sections
40 CFLAGS += -Wno-pointer-sign -fno-common
48 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o fs.o utf8.o correct.o
49 OBJ_P = util.o fs.o conout.o opts.o pak.o
50 OBJ_T = test.o util.o conout.o fs.o
51 OBJ_C = main.o lexer.o parser.o fs.o
52 OBJ_X = exec-standalone.o util.o conout.o fs.o
54 ifneq ("$(CYGWIN)", "")
55 #nullify the common variables that
56 #most *nix systems have (for windows)
63 TESTSUITE = testsuite.exe
66 ifneq ("$(MINGW)", "")
67 #nullify the common variables that
68 #most *nix systems have (for windows)
75 TESTSUITE = testsuite.exe
78 #arm support for linux .. we need to allow unaligned accesses
79 #to memory otherwise we just segfault everywhere
80 ifneq (, $(findstring arm, $(shell uname -m)))
81 CFLAGS += -munaligned-access
93 --date-format "%d %B, %Y" \
94 --seconds-per-day 0.01 \
95 --auto-skip-seconds 1 \
98 --camera-mode overview \
99 --highlight-all-users \
101 --hide progress,mouse \
103 --max-files 99999999999 \
104 --max-file-lag 0.000001 \
105 --bloom-multiplier 1.3 \
106 --logo doc/html/gmqcc.png \
109 #ffmpeg flags for gource
152 -shiftimplementation \
175 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
177 exec-standalone.o: exec.c
178 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
181 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
183 $(GMQCC): $(OBJ_C) $(OBJ_D)
184 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
186 $(TESTSUITE): $(OBJ_T)
187 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
190 $(CC) -o $@ $^ $(LDFLAGS)
192 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
200 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe
203 @ splint $(SPLINTFLAGS) *.c *.h
206 @ gource $(GOURCEFLAGS)
209 @ gource $(GOURCEFLAGS) -o - | ffmpeg $(FFMPEGFLAGS) gource.mp4
212 @makedepend -Y -w 65536 2> /dev/null \
213 $(subst .o,.c,$(OBJ_D))
214 @makedepend -a -Y -w 65536 2> /dev/null \
215 $(subst .o,.c,$(OBJ_T))
216 @makedepend -a -Y -w 65536 2> /dev/null \
217 $(subst .o,.c,$(OBJ_C))
218 @makedepend -a -Y -w 65536 2> /dev/null \
219 $(subst .o,.c,$(OBJ_X))
220 @makedepend -a -Y -w 65536 2> /dev/null \
221 $(subst .o,.c,$(OBJ_P))
224 install: install-gmqcc install-qcvm install-doc
225 install-gmqcc: $(GMQCC)
226 install -d -m755 $(DESTDIR)$(BINDIR)
227 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/$(GMQCC)
228 install-qcvm: $(QCVM)
229 install -d -m755 $(DESTDIR)$(BINDIR)
230 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/$(QCVM)
232 install -d -m755 $(DESTDIR)$(MANDIR)/man1
233 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
234 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
237 rm $(DESTDIR)$(BINDIR)/gmqcc
238 rm $(DESTDIR)$(BINDIR)/qcvm
239 rm $(DESTDIR)$(MANDIR)/man1/doc/gmqcc.1
240 rm $(DESTDIR)$(MANDIR)/man1/doc/qcvm.1
244 util.o: gmqcc.h opts.def
245 code.o: gmqcc.h opts.def
246 ast.o: gmqcc.h opts.def ast.h ir.h
247 ir.o: gmqcc.h opts.def ir.h
248 conout.o: gmqcc.h opts.def
249 ftepp.o: gmqcc.h opts.def lexer.h
250 opts.o: gmqcc.h opts.def
251 fs.o: gmqcc.h opts.def
252 utf8.o: gmqcc.h opts.def
253 correct.o: gmqcc.h opts.def
255 test.o: gmqcc.h opts.def
256 util.o: gmqcc.h opts.def
257 conout.o: gmqcc.h opts.def
258 fs.o: gmqcc.h opts.def
260 main.o: gmqcc.h opts.def lexer.h
261 lexer.o: gmqcc.h opts.def lexer.h
262 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h intrin.h
263 fs.o: gmqcc.h opts.def
265 util.o: gmqcc.h opts.def
266 conout.o: gmqcc.h opts.def
267 fs.o: gmqcc.h opts.def
269 util.o: gmqcc.h opts.def
270 fs.o: gmqcc.h opts.def
271 conout.o: gmqcc.h opts.def
272 opts.o: gmqcc.h opts.def
273 pak.o: gmqcc.h opts.def