Statistiques
| Révision :

root / pobysoC-4.0 / src / Makefile @ 24

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

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