Statistiques
| Révision :

root / pobysoC-4.0 / test / Makefile @ 14

Historique | Voir | Annoter | Télécharger (1,54 ko)

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