3 BINDIR := $(PREFIX)/bin
4 DATADIR := $(PREFIX)/share
5 MANDIR := $(DATADIR)/man
7 UNAME ?= $(shell uname)
8 CYGWIN = $(findstring CYGWIN, $(UNAME))
9 MINGW = $(findstring MINGW32, $(UNAME))
12 CFLAGS += -Wall -Wextra -I. -pedantic-errors -fno-strict-aliasing -fsigned-char
13 #turn on tons of warnings if clang is present
14 # but also turn off the STUPID ONES
19 -Wno-format-nonliteral \
20 -Wno-disabled-macro-expansion \
22 -Wno-missing-prototypes \
30 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o file.o utf8.o
31 OBJ_T = test.o util.o conout.o file.o
32 OBJ_C = main.o lexer.o parser.o file.o
33 OBJ_X = exec-standalone.o util.o conout.o file.o
35 ifneq ("$(CYGWIN)", "")
36 #nullify the common variables that
37 #most *nix systems have (for windows)
44 TESTSUITE = testsuite.exe
46 ifneq ("$(MINGW)", "")
47 #nullify the common variables that
48 #most *nix systems have (for windows)
55 TESTSUITE = testsuite.exe
57 #arm support for linux .. we need to allow unaligned accesses
58 #to memory otherwise we just segfault everywhere
59 ifneq (, $(findstring $(shell uname -m), "arm"))
60 CFLAGS += -munaligned-access
72 $(CC) -c $< -o $@ $(CFLAGS)
74 exec-standalone.o: exec.c
75 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
78 $(CC) -o $@ $^ $(CFLAGS) -lm
80 $(GMQCC): $(OBJ_C) $(OBJ_D)
81 $(CC) -o $@ $^ $(CFLAGS)
83 $(TESTSUITE): $(OBJ_T)
84 $(CC) -o $@ $^ $(CFLAGS)
86 all: $(GMQCC) $(QCVM) $(TESTSUITE)
92 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) *.dat
95 $(OBJ_D) $(OBJ_C) $(OBJ_X): gmqcc.h opts.def
97 parser.o: ast.h lexer.h
103 install: install-gmqcc install-qcvm install-doc
104 install-gmqcc: $(GMQCC)
105 install -d -m755 $(DESTDIR)$(BINDIR)
106 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/gmqcc
107 install-qcvm: $(QCVM)
108 install -d -m755 $(DESTDIR)$(BINDIR)
109 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/qcvm
111 install -d -m755 $(DESTDIR)$(MANDIR)/man1
112 install -m755 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
113 install -m755 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/