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