Statistiques
| Révision :

root / pobysoC-4.0 / src / Makefile @ 33

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

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