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 \
33 -Wno-missing-variable-declarations \
34 -Wno-unknown-warning-option
36 #Tiny C Compiler doesn't know what -pedantic-errors is
37 # and instead of ignoring .. just errors.
39 CFLAGS +=-pedantic-errors -ffunction-sections -fdata-sections -Wl,-gc-sections
41 CFLAGS += -Wno-pointer-sign -fno-common
49 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o fs.o utf8.o correct.o
50 OBJ_P = util.o fs.o conout.o opts.o pak.o
51 OBJ_T = test.o util.o conout.o fs.o
52 OBJ_C = main.o lexer.o parser.o fs.o
53 OBJ_X = exec-standalone.o util.o conout.o fs.o
55 ifneq ("$(CYGWIN)", "")
56 #nullify the common variables that
57 #most *nix systems have (for windows)
64 TESTSUITE = testsuite.exe
67 ifneq ("$(MINGW)", "")
68 #nullify the common variables that
69 #most *nix systems have (for windows)
76 TESTSUITE = testsuite.exe
79 #arm support for linux .. we need to allow unaligned accesses
80 #to memory otherwise we just segfault everywhere
81 ifneq (, $(findstring arm, $(shell uname -m)))
82 CFLAGS += -munaligned-access
94 --date-format "%d %B, %Y" \
95 --seconds-per-day 0.01 \
96 --auto-skip-seconds 1 \
99 --camera-mode overview \
100 --highlight-all-users \
102 --hide progress,mouse \
104 --max-files 99999999999 \
105 --max-file-lag 0.000001 \
106 --bloom-multiplier 1.3 \
107 --logo doc/html/gmqcc.png \
110 #ffmpeg flags for gource
153 -shiftimplementation \
176 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
178 exec-standalone.o: exec.c
179 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
182 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
184 $(GMQCC): $(OBJ_C) $(OBJ_D)
185 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
187 $(TESTSUITE): $(OBJ_T)
188 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
191 $(CC) -o $@ $^ $(LDFLAGS)
193 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
201 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe
204 @ splint $(SPLINTFLAGS) *.c *.h
207 @ gource $(GOURCEFLAGS)
210 @ gource $(GOURCEFLAGS) -o - | ffmpeg $(FFMPEGFLAGS) gource.mp4
213 @makedepend -Y -w 65536 2> /dev/null \
214 $(subst .o,.c,$(OBJ_D))
215 @makedepend -a -Y -w 65536 2> /dev/null \
216 $(subst .o,.c,$(OBJ_T))
217 @makedepend -a -Y -w 65536 2> /dev/null \
218 $(subst .o,.c,$(OBJ_C))
219 @makedepend -a -Y -w 65536 2> /dev/null \
220 $(subst .o,.c,$(OBJ_X))
221 @makedepend -a -Y -w 65536 2> /dev/null \
222 $(subst .o,.c,$(OBJ_P))
225 install: install-gmqcc install-qcvm install-doc
226 install-gmqcc: $(GMQCC)
227 install -d -m755 $(DESTDIR)$(BINDIR)
228 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/$(GMQCC)
229 install-qcvm: $(QCVM)
230 install -d -m755 $(DESTDIR)$(BINDIR)
231 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/$(QCVM)
233 install -d -m755 $(DESTDIR)$(MANDIR)/man1
234 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
235 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
238 rm $(DESTDIR)$(BINDIR)/gmqcc
239 rm $(DESTDIR)$(BINDIR)/qcvm
240 rm $(DESTDIR)$(MANDIR)/man1/doc/gmqcc.1
241 rm $(DESTDIR)$(MANDIR)/man1/doc/qcvm.1
245 util.o: gmqcc.h opts.def
246 code.o: gmqcc.h opts.def
247 ast.o: gmqcc.h opts.def ast.h ir.h
248 ir.o: gmqcc.h opts.def ir.h
249 conout.o: gmqcc.h opts.def
250 ftepp.o: gmqcc.h opts.def lexer.h
251 opts.o: gmqcc.h opts.def
252 fs.o: gmqcc.h opts.def
253 utf8.o: gmqcc.h opts.def
254 correct.o: gmqcc.h opts.def
256 test.o: gmqcc.h opts.def
257 util.o: gmqcc.h opts.def
258 conout.o: gmqcc.h opts.def
259 fs.o: gmqcc.h opts.def
261 main.o: gmqcc.h opts.def lexer.h
262 lexer.o: gmqcc.h opts.def lexer.h
263 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h intrin.h
264 fs.o: gmqcc.h opts.def
266 util.o: gmqcc.h opts.def
267 conout.o: gmqcc.h opts.def
268 fs.o: gmqcc.h opts.def
270 util.o: gmqcc.h opts.def
271 fs.o: gmqcc.h opts.def
272 conout.o: gmqcc.h opts.def
273 opts.o: gmqcc.h opts.def
274 pak.o: gmqcc.h opts.def