Makefile

Mon, 19 Sep 2011 08:11:08 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 19 Sep 2011 08:11:08 +0200
changeset 15
9a262e046ab8
parent 14
ee9333c91dda
child 16
bc9a0fefd892
permissions
-rw-r--r--

added license

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