]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - Makefile
Trailing whitespace was imminent, pending editor configuration change to accomodate...
[xonotic/gmqcc.git] / Makefile
index 2523742b35a8e1fa190c2808b36ce9291d0a6beb..ea2a27f2cf7b1b4936c9d11f8b2d721a6b947d6b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,36 @@
 CC     ?= clang
-CFLAGS += -Wall
-OBJ     = main.o      \
-          lex.o       \
+CFLAGS += -Wall -I. -pedantic-errors -std=c90 -Wno-attributes
+OBJ     = lex.o       \
           error.o     \
           parse.o     \
           typedef.o   \
           util.o      \
           code.o      \
-          asm.c       \
-          ast.c       \
-          ir.c
+          asm.o       \
+          ast.o       \
+          ir.o 
+OBJ_A = test/ast-test.o
+OBJ_I = test/ir-test.o
+OBJ_C = main.o
 
+#default is compiler only
+default: gmqcc
 %.o: %.c
        $(CC) -c $< -o $@ $(CFLAGS)
 
-gmqcc: $(OBJ)
+# test targets
+test_ast: $(OBJ_A) $(OBJ)
+       $(CC) -o $@ $^ $(CFLAGS)        
+test_ir:  $(OBJ_I) $(OBJ)
        $(CC) -o $@ $^ $(CFLAGS)
+test: test_ast test_ir
+
+# compiler target      
+gmqcc: $(OBJ_C) $(OBJ)
+       $(CC) -o $@ $^ $(CFLAGS)
+
+#all target is test and all
+all: test gmqcc
        
 clean:
-       rm -f *.o gmqcc
+       rm -f *.o gmqcc test_ast test_ir test/*.o