Makefile

changeset 37
1a67185e5496
parent 35
abaf2489c549
child 39
ac35daceb24c
--- a/Makefile	Fri Mar 04 15:02:22 2016 +0100
+++ b/Makefile	Tue Aug 23 12:05:41 2016 +0200
@@ -26,17 +26,31 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-include conf.mk
+# available configs: gcc, clang
+CONF=gcc
+
+include $(CONF).mk
+
 
-all: clean compile
+SRC  = c2html.c
+SRC += codegens.c
+SRC += ccodegen.c
+SRC += javacodegen.c
+
+OBJ = $(SRC:%.c=build/%$(OBJ_EXT))
+
+all: build build/$(BIN)
 	
-compile: build
-	cd src; $(MAKE)
-
+build/$(BIN): $(OBJ)
+	$(LD) -o $@ $^ $(LDFLAGS)
+	
+build/%$(OBJ_EXT): src/%.c
+	$(CC) -o $@ $(CFLAGS) -c $<
+	
 build:
 	$(MKDIR) build
 	
-test: compile
+test: build/$(BIN)
 	./build/$(BIN) test/ctestfile.c -o build/ctest.html \
 	-H test/header.html -F test/footer.html
 	./build/$(BIN) -j test/javatestfile.java -o build/javatest.html \
@@ -46,4 +60,4 @@
 	./build/$(BIN) -p test/plain.csp -o build/plain.html \
 	-H test/header.html -F test/footer.html
 clean:
-	$(RM) -f -R build
+	$(RM) $(RMFLAGS) build

mercurial