Makefile

Fri, 16 Sep 2011 10:36:45 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 16 Sep 2011 10:36:45 +0200
changeset 14
ee9333c91dda
parent 13
51b1ba3776b1
child 16
bc9a0fefd892
permissions
-rw-r--r--

some minor fixes + makefile now injects revisionnumber into cline.h

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

all: addrnum ${OBJ} remrnum
	${CC} -o ${BIN} ${OBJ}

addrnum:
	rm build/cline.o
	mv cline.h cline.src
	cat cline.src | sed "s/VERSION.*/VERSION=\"$(shell hg identify -i)\";/g" > cline.h
	
remrnum:
	rm cline.h
	mv cline.src cline.h

${BUILDDIR}%.o: %.c
	mkdir -p ${BUILDDIR}
	${CC} -c -std=c99 -o ${BUILDDIR}$*.o $<

clean:
	rm build/*

mercurial