1.1 --- a/Makefile Mon Sep 19 08:11:08 2011 +0200 1.2 +++ b/Makefile Tue Sep 20 15:19:28 2011 +0200 1.3 @@ -1,23 +1,32 @@ 1.4 CC = gcc 1.5 BUILDDIR = build/ 1.6 -OBJ = $(shell ls | grep \.c | sed 's/^\([^.]*\)\.c/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ') 1.7 +OBJ = $(shell ls | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ') 1.8 BIN = ${BUILDDIR}cline 1.9 1.10 -all: addrnum ${OBJ} remrnum 1.11 +.PHONY: setup run-compile teardown 1.12 + 1.13 +all: setup run-compile teardown 1.14 + 1.15 + 1.16 +run-compile: 1.17 + -${MAKE} compile 1.18 + 1.19 +compile: ${OBJ} 1.20 ${CC} -o ${BIN} ${OBJ} 1.21 1.22 -addrnum: 1.23 - rm build/cline.o 1.24 +setup: 1.25 + mkdir -p ${BUILDDIR} 1.26 + rm -f build/cline.o 1.27 mv cline.h cline.src 1.28 - cat cline.src | sed "s/VERSION.*/VERSION=\"$(shell hg identify -i)\";/g" > cline.h 1.29 + cat cline.src | sed "s/VERSION.*/VERSION=\"$(shell hg identify -n) ($(shell hg identify -i))\";/g" > cline.h 1.30 1.31 -remrnum: 1.32 - rm cline.h 1.33 +teardown: 1.34 + rm -f cline.h 1.35 mv cline.src cline.h 1.36 1.37 ${BUILDDIR}%.o: %.c 1.38 - mkdir -p ${BUILDDIR} 1.39 ${CC} -c -std=c99 -o ${BUILDDIR}$*.o $< 1.40 1.41 clean: 1.42 - rm build/* 1.43 + rm -f build/* 1.44 + 1.45 \ No newline at end of file