X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=Makefile;h=5486dd13eaf68e5da1fca94b230d0fe904b8bc65;hb=f47a20aa536ff345363415962f46bc4be5f60617;hp=9101d2b12a3600ae8e410e3b8ea8d31decdcd8de;hpb=f103544c95f7bda51446ab5f34d15a84fbf3d1bb;p=xonotic%2Fgmqcc.git diff --git a/Makefile b/Makefile index 9101d2b..5486dd1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ -CC ?= clang -CFLAGS += -Wall -I. -pedantic-errors -std=c90 +DESTDIR := +PREFIX := /usr/local +BINDIR := $(PREFIX)/bin +CC ?= clang +CFLAGS += -Wall -I. -fomit-frame-pointer -fno-stack-protector -fno-common #turn on tons of warnings if clang is present ifeq ($(CC), clang) CFLAGS += \ @@ -16,35 +19,49 @@ ifeq ($(CC), clang) -Wno-format-nonliteral endif +ifeq ($(track), no) + CFLAGS += -DNOTRACK +endif + OBJ = \ util.o \ code.o \ ast.o \ - ir.o -OBJ_A = test/ast-test.o -OBJ_I = test/ir-test.o + ir.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: $(OBJ_A) $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) -test_ir: $(OBJ_I) $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) -test: test_ast test_ir +exec-standalone.o: exec.c + $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1 + +qcvm: $(OBJ_X) + $(CC) -o $@ $^ $(CFLAGS) -lm # compiler target gmqcc: $(OBJ_C) $(OBJ) $(CC) -o $@ $^ $(CFLAGS) -#all target is test and all -all: test gmqcc +all: gmqcc qcvm clean: - rm -f *.o gmqcc test_ast test_ir test/*.o - + rm -f *.o gmqcc qcvm + +$(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