Makefile

changeset 37
1a67185e5496
parent 35
abaf2489c549
child 39
ac35daceb24c
     1.1 --- a/Makefile	Fri Mar 04 15:02:22 2016 +0100
     1.2 +++ b/Makefile	Tue Aug 23 12:05:41 2016 +0200
     1.3 @@ -26,17 +26,31 @@
     1.4  # POSSIBILITY OF SUCH DAMAGE.
     1.5  #
     1.6  
     1.7 -include conf.mk
     1.8 +# available configs: gcc, clang
     1.9 +CONF=gcc
    1.10  
    1.11 -all: clean compile
    1.12 +include $(CONF).mk
    1.13 +
    1.14 +
    1.15 +SRC  = c2html.c
    1.16 +SRC += codegens.c
    1.17 +SRC += ccodegen.c
    1.18 +SRC += javacodegen.c
    1.19 +
    1.20 +OBJ = $(SRC:%.c=build/%$(OBJ_EXT))
    1.21 +
    1.22 +all: build build/$(BIN)
    1.23  	
    1.24 -compile: build
    1.25 -	cd src; $(MAKE)
    1.26 -
    1.27 +build/$(BIN): $(OBJ)
    1.28 +	$(LD) -o $@ $^ $(LDFLAGS)
    1.29 +	
    1.30 +build/%$(OBJ_EXT): src/%.c
    1.31 +	$(CC) -o $@ $(CFLAGS) -c $<
    1.32 +	
    1.33  build:
    1.34  	$(MKDIR) build
    1.35  	
    1.36 -test: compile
    1.37 +test: build/$(BIN)
    1.38  	./build/$(BIN) test/ctestfile.c -o build/ctest.html \
    1.39  	-H test/header.html -F test/footer.html
    1.40  	./build/$(BIN) -j test/javatestfile.java -o build/javatest.html \
    1.41 @@ -46,4 +60,4 @@
    1.42  	./build/$(BIN) -p test/plain.csp -o build/plain.html \
    1.43  	-H test/header.html -F test/footer.html
    1.44  clean:
    1.45 -	$(RM) -f -R build
    1.46 +	$(RM) $(RMFLAGS) build

mercurial