Makefile

changeset 34
fa9bda32de17
parent 32
51d6e45a7592
child 35
35120de6ee53
     1.1 --- a/Makefile	Tue Oct 02 10:49:25 2012 +0200
     1.2 +++ b/Makefile	Fri Dec 28 15:44:28 2012 +0100
     1.3 @@ -38,6 +38,10 @@
     1.4  #endif
     1.5  
     1.6  VERSION_PREFIX=1.0.
     1.7 +SRCDIR=src/
     1.8 +BUILDDIR=build/
     1.9 +OBJ = $(shell ls ${SRCDIR} | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
    1.10 +BIN = ${BUILDDIR}cline
    1.11  
    1.12  include ${CONF}.mk
    1.13  
    1.14 @@ -52,17 +56,19 @@
    1.15  compile: ${OBJ}
    1.16  	${LD} -o ${BIN} ${OBJ} ${LDFLAGS}
    1.17  
    1.18 -setup:
    1.19 -	mkdir -p ${BUILDDIR}
    1.20 +setup: ${BUILDDIR}
    1.21  	rm -f ${BUILDDIR}cline.o
    1.22 -	mv cline.h cline.src
    1.23 -	cat cline.src | sed "s/VERSION.*/VERSION=\"${VERSION_PREFIX}$(shell hg identify -n) ($(shell hg identify -i))\";/g" > cline.h
    1.24 +	mv ${SRCDIR}cline.h ${SRCDIR}cline.src
    1.25 +	cat ${SRCDIR}cline.src | sed "s/VERSION.*/VERSION=\"${VERSION_PREFIX}$(shell hg identify -n) ($(shell hg identify -i))\";/g" > ${SRCDIR}cline.h
    1.26 +	
    1.27 +${BUILDDIR}:
    1.28 +	mkdir ${BUILDDIR}
    1.29  	
    1.30  teardown:
    1.31 -	rm -f cline.h
    1.32 -	mv cline.src cline.h
    1.33 +	rm -f ${SRCDIR}cline.h
    1.34 +	mv ${SRCDIR}cline.src ${SRCDIR}cline.h
    1.35  
    1.36 -${BUILDDIR}%.o: %.c
    1.37 +${BUILDDIR}%.o: ${SRCDIR}%.c
    1.38  	${CC} ${CFLAGS} -c -o ${BUILDDIR}$*.o $<
    1.39  
    1.40  clean:

mercurial