Rduced the number of files copied for INSTALL
[libfirm] / MakeRules.in
1 # Hey Emacs, this is a -*- makefile -*-
2 #
3 # libFIRM Project
4 #
5 # $Id$
6 #
7
8 VPATH = $(srcdir)
9
10 CC = @CC@
11 CFLAGS := @CFLAGS@
12 CPPFLAGS := -I. -I$(topdir) -I$(srcdir) -I$(top_srcdir) @CPPFLAGS@
13
14 INSTALL = @INSTALL@
15 INCLUDEDIR = @includedir@
16 LIBDIR = @libdir@
17
18 DEFS = @DEFS@
19
20 LD := @LD@
21 LDFLAGS := @LDFLAGS@
22 LD_R := @libfirm_cv_prog_ld_r@
23
24 # profiling enabled?
25 ifeq (@enable_profile_libfirm@,yes)
26 LDFLAGS += -g -pg
27 endif
28
29 AR := @AR@
30 ARFLAGS := rc
31
32 RANLIB := @RANLIB@
33
34 DISTFILES = $(SOURCES)
35 CFILES = $(filter %.c,$(SOURCES) $(GENFILES))
36 HFILES = $(filter %.h,$(SOURCES) $(GENFILES))
37 OFILES = $(CFILES:.c=.o)
38
39 TAGFILES = $(CFILES) $(HFILES)
40
41 LDLIBS=$(LIBS) -lm -lc
42
43 COMPILE.c = $(CC) -c $(DEFS) $(CPPFLAGS) $(CDEBUG) $(CFLAGS) $(XCFLAGS)
44 COMPILE.s = $(CC) -S $(DEFS) $(CPPFLAGS) $(CDEBUG) $(CFLAGS) $(XCFLAGS)
45
46 %.o: %.c
47         $(COMPILE.c) -o $@ $<
48
49 %.s: %.c
50         $(COMPILE.s) -o $@ $<
51
52 %.i: %.c
53         $(CPP) $(DEFS) $(CPPFLAGS) -o $@ $<
54
55 %.c: %.dot
56         $(DT) $(DTFLAGS) <$^ >$@ || $(fail)
57
58
59 define fail
60 { $(RM) $@; false; }
61 endef
62
63 # make target given by $@ recursively in $^ ...
64 ifeq (,$(findstring k,$(MAKEFLAGS)))
65 # ... and immediately stop on errors
66 define recurse
67 +@for i in $^ ""; do if test $$i; then $(MAKE) -C $$i $(subst subdir_,,$@) || exit $$?; fi; done
68 endef
69 else
70 # ... and keep going after errors
71 define recurse
72 +@fail=; \
73 for i in $^ ""; do if test $$i; then $(MAKE) -C $$i $(subst subdir_,,$@) || fail=y; fi; done; \
74 test -z "$$fail"
75 endef
76 endif
77
78 targets = all clean depend echodist echogen echosrc realclean tags install