X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=Makefile;h=84334157040d4bf900c8018964ac04bba6d0a62b;hb=613e1e7247c8dd271979b9e9d70ff7735ef5282b;hp=25ee1a47c0ea70233c66a10bb8a9518a97224607;hpb=453ca4517610abfd5fdc28d32e89a9814e72fd52;p=xonotic%2Fgmqcc.git diff --git a/Makefile b/Makefile index 25ee1a4..8433415 100644 --- a/Makefile +++ b/Makefile @@ -1,37 +1,72 @@ +DESTDIR := +PREFIX := /usr/local +BINDIR := $(PREFIX)/bin + CC ?= clang -CFLAGS += -Wall -I. -pedantic-errors -std=c90 -OBJ = main.o \ - lex.o \ - error.o \ - parse.o \ - typedef.o \ +CFLAGS += -Wall -Wextra -I. -pedantic-errors +#turn on tons of warnings if clang is present +ifeq ($(CC), clang) + CFLAGS += \ + -Weverything \ + -Wno-padded \ + -Wno-format-nonliteral \ + -Wno-disabled-macro-expansion \ + -Wno-conversion \ + -Wno-missing-prototypes + +endif +ifeq ($(track), no) + CFLAGS += -DNOTRACK +endif + +OBJ = \ util.o \ code.o \ - asm.o \ ast.o \ - ir.o -# ast and ir test -TEST_AST = test/ast-test.o -TEST_IR = test/ir-test.o + ir.o \ + con.o \ + ftepp.o + +OBJ_T = test.o util.o con.o +OBJ_C = main.o lexer.o parser.o +OBJ_X = exec-standalone.o util.o con.o + -#default is compiler only default: gmqcc %.o: %.c $(CC) -c $< -o $@ $(CFLAGS) -# test targets -test_ast: $(TEST_AST) $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) -test_ir: $(TEST_IR) $(OBJ) +exec-standalone.o: exec.c + $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1 + +qcvm: $(OBJ_X) + $(CC) -o $@ $^ $(CFLAGS) -lm + +gmqcc: $(OBJ_C) $(OBJ) $(CC) -o $@ $^ $(CFLAGS) -test: test_ast test_ir -# compiler target -gmqcc: $(OBJ) +testsuite: $(OBJ_T) $(CC) -o $@ $^ $(CFLAGS) -#all target is test and all -all: test gmqcc - +all: gmqcc qcvm testsuite + +check: all + ./testsuite + clean: - rm -f *.o gmqcc test_ast test_ir test/*.o + rm -f *.o gmqcc qcvm testsuite *.dat + + +$(OBJ) $(OBJ_C) $(OBJ_X): gmqcc.h +main.o: lexer.h +parser.o: ast.h lexer.h +ast.o: ast.h ir.h +ir.o: ir.h + +install: install-gmqcc install-qcvm +install-gmqcc: gmqcc + install -d -m755 $(DESTDIR)$(BINDIR) + install -m755 gmqcc $(DESTDIR)$(BINDIR)/gmqcc +install-qcvm: qcvm + install -d -m755 $(DESTDIR)$(BINDIR) + install -m755 qcvm $(DESTDIR)$(BINDIR)/qcvm