bd30fb39962f498878cf0c9f307bc1e624eb7f22
[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
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 autodoc_xref: subdir_autodoc_xref local_autodoc_xref
39 .PHONY: local_autodoc_xref
40 local_autodoc_xref: $(LOCALXREFSFILE)
41
42 autodoc_html: subdir_autodoc_html local_autodoc_html
43 .PHONY: local_autodoc_html
44 local_autodoc_html: $(HTMLFILES)
45
46
47 # generate an archive for distribution
48 dist:   subdir_dist local_dist
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
56 # dont know about this
57 # Recurse into $(subdirs) for $(targets)
58 $(addprefix subdir_,$(targets)): $(subdirs)
59         +$(recurse)
60
61 Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
62         cd $(topdir) && \
63         CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status >&2
64
65 # generate TAGS
66 tags:   subdir_tags local_tags
67 .PHONY: local_tags
68 local_tags:     $(TAGFILES)
69         etags -C $^
70
71 # installation
72 install:        subdir_install local_install
73 local_install: $(INCLUDEDIR) $(LIBDIR)
74 ifneq ($(strip $(INSTALL_HEADERS)),)
75         $(INSTALL) -m u+rw,a+r $(addprefix $(srcdir)/,$(INSTALL_HEADERS)) $(INCLUDEDIR)
76 endif
77 ifneq ($(strip $(INSTALL_LIBS)),)
78         $(INSTALL) -m u+rw,a+r $(addprefix $(topdir)/,$(INSTALL_LIBS)) $(LIBDIR)
79 endif
80
81 $(LIBDIR):      $(LIBDIR)
82         mkdir -p $@
83
84 $(INCLUDEDIR):  $(INCLUDEDIR)
85         mkdir -p $@
86
87 $(AUTODOCDIR):
88         mkdir $@
89
90 # include dependencies
91 -include .depend