Makefile

Thu, 01 Dec 2011 17:06:27 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 01 Dec 2011 17:06:27 +0100
changeset 26
853a1181884b
parent 23
778388400f7b
child 28
72a98cbcb9f1
permissions
-rw-r--r--

Merge with 3963e8800a1268be93d938c709e2d4be4d0b2d39

CC = gcc
CARG = -Wall -std=gnu99 -O
BUILDDIR = build/
OBJ = $(shell ls | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
BIN = ${BUILDDIR}cline

.PHONY: setup run-compile teardown

all: setup run-compile teardown
	
	
run-compile:
	-${MAKE} compile

compile: ${OBJ}
	${CC} -o ${BIN} ${OBJ}

setup:
	mkdir -p ${BUILDDIR}
	rm -f build/cline.o
	mv cline.h cline.src
	cat cline.src | sed "s/VERSION.*/VERSION=\"$(shell hg identify -n) ($(shell hg identify -i))\";/g" > cline.h
	
teardown:
	rm -f cline.h
	mv cline.src cline.h

${BUILDDIR}%.o: %.c
	${CC} ${CARG} -c -o ${BUILDDIR}$*.o $<

clean:
	rm -f build/*
	

mercurial