annotate src/Makefile @ 4:399517bf65dc

Add rules for X_main to Makefile
author Thinker K.F. Li <thinker@branda.to>
date Fri, 25 Jul 2008 11:42:37 +0800
parents 31402929c587
children 9c331ec9e210
rev   line source
2
31402929c587 Transform position
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
1 SRCS = coord.c
1
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 TESTCASE_OBJS = ${SRCS:C/(.*)\.c/testcase-\1.o/g}
2
31402929c587 Transform position
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
3 CFLAGS = -I/usr/local/include
4
399517bf65dc Add rules for X_main to Makefile
Thinker K.F. Li <thinker@branda.to>
parents: 2
diff changeset
4 BINS = testcase X_main
1
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5
2
31402929c587 Transform position
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
6 all: $(BINS)
1
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 testcase: testcase.o $(TESTCASE_OBJS)
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) -L/usr/local/lib -lcunit
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 .for i in $(TESTCASE_OBJS)
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 ${i}: ${i:C/testcase-(.*).o/\1.c/}
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 $(CC) $(CFLAGS) -DUNITTEST -g -c -o $@ $(.ALLSRC)
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 .endfor
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 testcase.o: testcase.c
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 $(CC) $(CFLAGS) -c $(.ALLSRC)
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18
4
399517bf65dc Add rules for X_main to Makefile
Thinker K.F. Li <thinker@branda.to>
parents: 2
diff changeset
19 X_main: X_main.o
399517bf65dc Add rules for X_main to Makefile
Thinker K.F. Li <thinker@branda.to>
parents: 2
diff changeset
20 $(CC) $(CFALGS) `pkg-config --libs cairo` -o $@ $(.ALLSRC)
399517bf65dc Add rules for X_main to Makefile
Thinker K.F. Li <thinker@branda.to>
parents: 2
diff changeset
21
399517bf65dc Add rules for X_main to Makefile
Thinker K.F. Li <thinker@branda.to>
parents: 2
diff changeset
22 X_main.o: X_main.c
399517bf65dc Add rules for X_main to Makefile
Thinker K.F. Li <thinker@branda.to>
parents: 2
diff changeset
23 $(CC) $(CFLAGS) `pkg-config --cflags cairo` -c $(.ALLSRC)
399517bf65dc Add rules for X_main to Makefile
Thinker K.F. Li <thinker@branda.to>
parents: 2
diff changeset
24
1
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 clean:
2
31402929c587 Transform position
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
26 for i in *.o *~ *.core $(BINS); do \
1
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 echo "delete $$i"; \
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 rm -f $$i; \
b5c0162ccf69 Coordination tranforming
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 done