Makefile

Tue, 20 Sep 2011 15:19:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 20 Sep 2011 15:19:28 +0200
changeset 16
bc9a0fefd892
parent 14
ee9333c91dda
child 18
cae1294702aa
permissions
-rw-r--r--

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/*

mercurial