Makefile

Tue, 20 Sep 2011 15:19:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 20 Sep 2011 15:19:28 +0200
changeset 16
bc9a0fefd892
parent 14
ee9333c91dda
child 18
cae1294702aa
permissions
-rw-r--r--

fixed makefile to run safely on compile errors + added -V option to cline

0
518bfd1cc1e8 cline project init
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 CC = gcc
13
51b1ba3776b1 changed makefile to auto-include any source file
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
2 BUILDDIR = build/
16
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
3 OBJ = $(shell ls | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
14
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 13
diff changeset
4 BIN = ${BUILDDIR}cline
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 13
diff changeset
5
16
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
6 .PHONY: setup run-compile teardown
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
7
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
8 all: setup run-compile teardown
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
9
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
10
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
11 run-compile:
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
12 -${MAKE} compile
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
13
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
14 compile: ${OBJ}
14
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 13
diff changeset
15 ${CC} -o ${BIN} ${OBJ}
0
518bfd1cc1e8 cline project init
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16
16
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
17 setup:
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
18 mkdir -p ${BUILDDIR}
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
19 rm -f build/cline.o
14
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 13
diff changeset
20 mv cline.h cline.src
16
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
21 cat cline.src | sed "s/VERSION.*/VERSION=\"$(shell hg identify -n) ($(shell hg identify -i))\";/g" > cline.h
14
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 13
diff changeset
22
16
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
23 teardown:
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
24 rm -f cline.h
14
ee9333c91dda some minor fixes + makefile now injects revisionnumber into cline.h
Mike Becker <universe@uap-core.de>
parents: 13
diff changeset
25 mv cline.src cline.h
1
34a5e235d16e cline version 2
Mike Becker <universe@uap-core.de>
parents: 0
diff changeset
26
13
51b1ba3776b1 changed makefile to auto-include any source file
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
27 ${BUILDDIR}%.o: %.c
51b1ba3776b1 changed makefile to auto-include any source file
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
28 ${CC} -c -std=c99 -o ${BUILDDIR}$*.o $<
3
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
29
510d6b198dde Moved some functions to functions.c
Mike Becker <universe@uap-core.de>
parents: 1
diff changeset
30 clean:
16
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
31 rm -f build/*
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 14
diff changeset
32

mercurial