Statistiques
| Révision :

root / approxBasisSollya / test / test-read-lines / Makefile @ 301

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

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