root / pobysoC / test / Makefile @ 3
Historique | Voir | Annoter | Télécharger (1,54 ko)
1 |
CC = gcc |
---|---|
2 |
CFLAGS = -Wall -g |
3 |
LDLIB = #-Wl,--verbose |
4 |
|
5 |
OBJS = |
6 |
INCS = |
7 |
SOURCES = $(INCS) |
8 |
|
9 |
TEST_DRIVER = # CUnit test driver binary program |
10 |
|
11 |
ALL_TARGETS = |
12 |
|
13 |
SCRATCH_PRG := $(patsubst %.c,%,$(wildcard *.c)) |
14 |
SCRATCH_ALL := $(SCRATCH_PRG) |
15 |
|
16 |
LAST_ARCH_FILE = lastArch.txt |
17 |
|
18 |
ARCH := $(shell uname -m) |
19 |
|
20 |
DUMMY := $(shell touch $(LAST_ARCH_FILE)) |
21 |
|
22 |
LAST_ARCH := $(shell cat $(LAST_ARCH_FILE)) |
23 |
|
24 |
ifneq ($(LAST_ARCH), $(ARCH)) |
25 |
DUMMY := $(shell echo $(ARCH) > $(LAST_ARCH_FILE)) |
26 |
DUMMY := $(shell $(MAKE) clean) |
27 |
endif |
28 |
|
29 |
ifeq (x86_64, $(ARCH)) |
30 |
CFLAGS := -m64 $(CFLAGS) |
31 |
# LDLIB := |
32 |
endif |
33 |
|
34 |
ifeq (ppc64, $(ARCH)) |
35 |
CFLAGS := -m64 $(CFLAGS) |
36 |
# LDLIB := |
37 |
endif |
38 |
|
39 |
ifeq (i686, $(ARCH)) |
40 |
# CFLAGS := $(CFLAGS) |
41 |
# LDLIB := |
42 |
endif |
43 |
|
44 |
# ------------------------------------------------------------------------- |
45 |
|
46 |
default: all |
47 |
# Remove all implicit (suffix) rules. No need to remove pattern rules. |
48 |
# Just redefine them. |
49 |
.SUFFIXES: |
50 |
# Keep the OBJS we want to link with user code. |
51 |
.PRECIOUS: $(OBJS) |
52 |
|
53 |
all: $(ALL_TARGETS) |
54 |
test: $(TEST_DRIVER) |
55 |
|
56 |
% : %.o $(OBJS) |
57 |
$(CC) $(CFLAGS) -o $@ $< $(OBJS) $(LDLIB) |
58 |
|
59 |
%.o : %.c $(INCS) |
60 |
$(CC) $(CFLAGS) -c -o $@ $< |
61 |
|
62 |
$(TEST_DRIVER) : |
63 |
make -C test |
64 |
cp test/$(TEST_DRIVER) . |
65 |
# ------------------------------------------------------------------------- |
66 |
|
67 |
.PHONY: clean scratch |
68 |
|
69 |
clean: |
70 |
@rm -f $(ALL_TARGETS) $(TEST_DRIVER) |
71 |
@rm -f *.o a.out $(OBJS) |
72 |
@rm -f *~ *% #*# |
73 |
|
74 |
scratch: clean |
75 |
rm -f $(SCRATCH_ALL) |
76 |
|
77 |
# Change the documentation configuration and path accordingly. |
78 |
documentation: pobyso.doxyconf $(SOURCES) |
79 |
doxygen pobyso.doxyconf |