Makefile

changeset 14
ee9333c91dda
parent 13
51b1ba3776b1
child 16
bc9a0fefd892
equal deleted inserted replaced
13:51b1ba3776b1 14:ee9333c91dda
1 CC = gcc 1 CC = gcc
2 BUILDDIR = build/ 2 BUILDDIR = build/
3 OBJ = $(shell ls | grep \.c | sed 's/^\([^.]*\)\.c/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ') 3 OBJ = $(shell ls | grep \.c | sed 's/^\([^.]*\)\.c/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
4 BIN = ${BUILDDIR}/cline 4 BIN = ${BUILDDIR}cline
5 5
6 all: ${OBJ} 6 all: addrnum ${OBJ} remrnum
7 ${CC} -o ${BIN} ${OBJ} 7 ${CC} -o ${BIN} ${OBJ}
8
9 addrnum:
10 rm build/cline.o
11 mv cline.h cline.src
12 cat cline.src | sed "s/VERSION.*/VERSION=\"$(shell hg identify -i)\";/g" > cline.h
13
14 remrnum:
15 rm cline.h
16 mv cline.src cline.h
8 17
9 ${BUILDDIR}%.o: %.c 18 ${BUILDDIR}%.o: %.c
10 mkdir -p ${BUILDDIR} 19 mkdir -p ${BUILDDIR}
11 ${CC} -c -std=c99 -o ${BUILDDIR}$*.o $< 20 ${CC} -c -std=c99 -o ${BUILDDIR}$*.o $<
12 21

mercurial