Tue, 20 Sep 2011 15:19:28 +0200
fixed makefile to run safely on compile errors + added -V option to cline
universe@0 | 1 | CC = gcc |
universe@13 | 2 | BUILDDIR = build/ |
universe@16 | 3 | OBJ = $(shell ls | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ') |
universe@14 | 4 | BIN = ${BUILDDIR}cline |
universe@0 | 5 | |
universe@16 | 6 | .PHONY: setup run-compile teardown |
universe@16 | 7 | |
universe@16 | 8 | all: setup run-compile teardown |
universe@16 | 9 | |
universe@16 | 10 | |
universe@16 | 11 | run-compile: |
universe@16 | 12 | -${MAKE} compile |
universe@16 | 13 | |
universe@16 | 14 | compile: ${OBJ} |
universe@10 | 15 | ${CC} -o ${BIN} ${OBJ} |
universe@1 | 16 | |
universe@16 | 17 | setup: |
universe@16 | 18 | mkdir -p ${BUILDDIR} |
universe@16 | 19 | rm -f build/cline.o |
universe@14 | 20 | mv cline.h cline.src |
universe@16 | 21 | cat cline.src | sed "s/VERSION.*/VERSION=\"$(shell hg identify -n) ($(shell hg identify -i))\";/g" > cline.h |
universe@14 | 22 | |
universe@16 | 23 | teardown: |
universe@16 | 24 | rm -f cline.h |
universe@14 | 25 | mv cline.src cline.h |
universe@14 | 26 | |
universe@13 | 27 | ${BUILDDIR}%.o: %.c |
universe@13 | 28 | ${CC} -c -std=c99 -o ${BUILDDIR}$*.o $< |
universe@3 | 29 | |
universe@3 | 30 | clean: |
universe@16 | 31 | rm -f build/* |
universe@16 | 32 |