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