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