changing is not creating ;-)
[libfirm] / MakeTargets
1 #
2 # Project:     libFIRM
3 # File name:   MakeTargets
4 # Purpose:
5 # Author:      nicht Till Riedel, das waren andere
6 # Modified by:
7 # Created:
8 # CVS-ID:      $Id$
9 # Copyright:   (c) 2002-2003 Universität Karlsruhe
10 # Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11 #
12
13 .PHONY: subdir_all
14
15 all : subdir_all
16
17 # partial linking of a subdir's $(OFILES) into one file
18 subdir.o: $(OFILES)
19 ifeq ($(strip $(OFILES)),)
20         >$@
21 else
22         rm -f $@
23         $(LD) $(LDFLAGS)  -r -o $@ $^
24 endif
25
26 clean: subdir_clean local_clean
27 .PHONY: local_clean
28 local_clean:
29         $(RM) $(OFILES) subdir.o core
30
31 realclean: subdir_realclean local_clean
32         $(RM) $(GENFILES) .depend TAGS $(TARDIRNAME)
33
34 depend: subdir_depend local_depend
35 .PHONY: local_depend
36 local_depend: $(CFILES) $(filter %.h,$(SOURCES) $(GENFILES))
37 ifeq ($(strip $(CFILES)),)
38         >.depend
39 else
40         $(CC) -M $(DEFS) $(CPPFLAGS) $(filter %.c,$^) >.depend || { $(RM) .depend; false; }
41 endif
42
43
44 # generate an archive for distribution
45 distrib: dist
46         $(MAKE) -C testprograms dist
47
48 dist:   subdir_dist local_dist $(TARDIRNAME)
49 #       @echo create archive with $(DISTFILES)
50 #       @echo tar -C $(top_srcdir) -uf libfirm.tar $(ARCHIVEDISTFILES)
51         $(TAR) $(TARFLAGS) $(ARCHIVEDISTFILES)
52 .PHONY: local_dist
53 local_dist:     $(DISTFILES)
54
55 $(TARDIRNAME):
56         $(LN_S) $(top_srcdir) $@
57
58 # dont know about this
59 # Recurse into $(subdirs) for $(targets)
60 $(addprefix subdir_,$(targets)): $(subdirs)
61         +$(recurse)
62
63 Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
64         cd $(topdir) && \
65         CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status >&2
66
67 # generate TAGS
68 tags:   subdir_tags local_tags
69 .PHONY: local_tags
70 local_tags:     $(TAGFILES)
71         etags -C $^
72
73 # installation
74 install:        $(INCLUDEDIR) install_headers $(LIBDIR) install_libs
75
76 install_headers:        subdir_install_headers local_install_headers
77 local_install_headers:
78 ifneq ($(strip $(INSTALL_HEADERS)),)
79         $(INSTALL)  -m u+rw,a+r $(addprefix $(srcdir)/,$(INSTALL_HEADERS)) $(INCLUDEDIR)
80 endif
81
82 install_libs:           subdir_install_libs local_install_libs
83 local_install_libs:
84 ifneq ($(strip $(INSTALL_LIBS)),)
85         $(INSTALL)  -m u+rw,a+r $(addprefix $(topdir)/,$(INSTALL_LIBS)) $(LIBDIR)
86 endif
87
88
89 $(LIBDIR):
90         mkdir -p $@
91
92 $(INCLUDEDIR):
93         mkdir -p $@
94
95 # generated the directory where all the generated documentation is
96 $(AUTODOCDIR):
97         mkdir -p $@
98
99 # print some help
100 .PHONY: help
101 help:
102         @echo "possible targets are:"
103         @echo "[$(targets)]"
104         @echo "but not all of them should be used or make sense"
105
106 # include dependencies
107 -include .depend