use pkg-config for libcore detection
[libfirm] / Makefile.in
1 #
2 # Project:     libFIRM
3 # File name:   Makefile.in
4 # Purpose:     Top level Makefile
5 # Author:      Till Riedel
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
14 # top directory of the source tree
15 top_srcdir := @top_srcdir@
16 # directory with the sources for this directory
17 srcdir := @srcdir@
18 # top directory of the configured tree
19 topdir := .
20 # subdirectory under topdir
21 subdir := .
22 # do we want statistics
23 enable_statistics := @enable_statistics@
24 # do we want external description of effects
25 enable_external_effects := @enable_external_effects@
26 # do we want to use the libcore for debug and ADT support
27 enable_libcore := @enable_libcore@
28
29 LIBCORE_CFLAGS = @LIBCORE_CFLAGS@
30 LIBCORE_LIBS   = @LIBCORE_LFLAGS@
31
32 # suck in values for the linking procedure:
33 LDFLAGS                 = @LDFLAGS@ $(LIBCORE_CFLAGS)
34 LIBS                    = @LIBS@ $(LIBCORE_LIBS)
35
36 # plugin subdirectories
37 plugin_subdirs := @plugin_subdirs@
38
39 build_subdirs := ir/adt ir/net ir/debug ir/tv ir/common ir/ident ir/ir \
40                 ir/opt ir/tr ir/ana ir/stat ir/ana2 ir/arch ir/lower \
41                 $(plugin_subdirs)
42
43 ifeq (@enable_external_effects@,yes)
44 build_subdirs += ir/external
45 endif
46
47 build_add_lib := libfirm_xmalloc.a
48
49 subdirs := $(build_subdirs) ir/config
50
51 SOURCES := Makefile.in MakeRules.in MakeTargets\
52            aclocal.m4 config.h.in\
53            config.guess config.sub configure.in \
54            stamp-h.in install-sh README configure
55
56 SHARED_LIB = libfirm.so
57
58 INSTALL_LIBS = libfirm.a $(build_add_lib)
59
60 GENFILES := stamp-h config.log config.cache
61 # config.status config.h.in $(srcdir)/stamp-h.in
62
63 include $(topdir)/MakeRules
64
65 XOFILES += $(addsuffix /subdir.o, $(build_subdirs))
66
67 include $(top_srcdir)/MakeTargets
68
69 # add target firmjni if configured with --enable-firmjni
70 all: firm
71
72 firm: libfirm.a $(build_add_lib)
73
74 shared: $(SHARED_LIB)
75
76 $(OFILES): config.h Makefile
77
78 $(XOFILES): subdir_all
79
80 libfirm.a: $(XOFILES) $(OFILES)
81         $(AR) $(ARFLAGS) $@.new $^
82         mv -f $@.new $@
83         $(RANLIB) $@
84
85 libfirm_xmalloc.a: subdir_all ir/adt/xmalloc.o
86         $(AR) $(ARFLAGS) $@.new ir/adt/xmalloc.o
87         mv -f $@.new $@
88
89 # dont know about xml here
90 libfirm.so: $(XOFILES)
91         ld -Bshareable -o ./libfirm.so $(XOFILES) -lm $(LDFLAGS) $(LIBS)
92
93 testprograms:   libfirm.a
94         $(MAKE) -C testprograms
95
96 firmjni:: libfirm.a
97         $(MAKE) -C firmjni
98
99 # gernerate program documentation
100 .PHONY: autodoc
101 autodoc: $(DOXYFILE)
102         $(DOXYGEN) $(DOXYFILE)
103
104 #${srcdir}/configure: configure.in aclocal.m4
105 $(srcdir)/configure: configure.in
106         cd $(srcdir) && autoconf
107
108 # autoheader might not change config.h.in, so touch a stamp file.
109 $(srcdir)/config.h.in: stamp-h.in
110
111 #${srcdir\1c2/stamp-h.in: configure.in aclocal.m4 acconfig.h \
112 $(srcdir)/stamp-h.in: configure.in
113         cd $(srcdir) && autoheader
114         echo timestamp > $(srcdir)/stamp-h.in
115
116 config.h: stamp-h
117 stamp-h: config.h.in config.status
118         ./config.status
119
120 config.status: configure
121         ./config.status --recheck
122
123 # add target test-firmjni if configured with --enable-firmjni
124 test::
125         $(MAKE) -C testprograms test;
126
127 test-firmjni::
128         $(MAKE) -C firmjni test;
129
130 test-reference::
131         $(MAKE) -C testprograms reference;
132
133 test-clean:
134         $(MAKE) -C testprograms realclean
135         $(MAKE) -C firmjni/testprograms clean;