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. -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 \
26 #Tiny C Compiler doesn't know what -pedantic-errors is
27 # and instead of ignoring .. just errors.
29 CFLAGS +=-pedantic-errors
31 CFLAGS += -Wno-pointer-sign -fno-common
39 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o file.o utf8.o
40 OBJ_T = test.o util.o conout.o file.o
41 OBJ_C = main.o lexer.o parser.o file.o
42 OBJ_X = exec-standalone.o util.o conout.o file.o
44 ifneq ("$(CYGWIN)", "")
45 #nullify the common variables that
46 #most *nix systems have (for windows)
53 TESTSUITE = testsuite.exe
55 ifneq ("$(MINGW)", "")
56 #nullify the common variables that
57 #most *nix systems have (for windows)
64 TESTSUITE = testsuite.exe
66 #arm support for linux .. we need to allow unaligned accesses
67 #to memory otherwise we just segfault everywhere
68 ifneq (, $(findstring arm, $(shell uname -m)))
69 CFLAGS += -munaligned-access
81 $(CC) -c $< -o $@ $(CFLAGS)
83 exec-standalone.o: exec.c
84 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
87 $(CC) -o $@ $^ $(CFLAGS) -lm
89 $(GMQCC): $(OBJ_C) $(OBJ_D)
90 $(CC) -o $@ $^ $(CFLAGS)
92 $(TESTSUITE): $(OBJ_T)
93 $(CC) -o $@ $^ $(CFLAGS)
95 all: $(GMQCC) $(QCVM) $(TESTSUITE)
101 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) *.dat
104 $(OBJ_D) $(OBJ_C) $(OBJ_X): gmqcc.h opts.def
106 parser.o: ast.h lexer.h
112 install: install-gmqcc install-qcvm install-doc
113 install-gmqcc: $(GMQCC)
114 install -d -m755 $(DESTDIR)$(BINDIR)
115 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/gmqcc
116 install-qcvm: $(QCVM)
117 install -d -m755 $(DESTDIR)$(BINDIR)
118 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/qcvm
120 install -d -m755 $(DESTDIR)$(MANDIR)/man1
121 install -m755 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
122 install -m755 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/