-# Hey Emacs, this is a -*- makefile -*-
#
-# libFIRM Project
-#
-# Top level Makefile
-# $Id$
+# Project: libFIRM
+# File name: Makefile.in
+# Purpose: Top level Makefile
+# Author: Till Riedel
+# Modified by:
+# Created:
+# CVS-ID: $Id$
+# Copyright: (c) 2002-2003 Universität Karlsruhe
+# Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
#
topdir := .
# subdirectory under topdir
subdir := .
-
-prefix := @prefix@
-exec_prefix := @exec_prefix@
-bindir = $(exec_prefix)/bin
-datadir = $(prefix)/lib
-
-subdirs := ir ir/adt ir/debug ir/tv ir/common ir/ident ir/ir ir/tr
+# do we want statistics
+enable_statistics := @enable_statistics@
+# do we want external description of effects
+enable_external_effects := @enable_external_effects@
+# do we want to use the libcore for debug and ADT support
+enable_libcore := @enable_libcore@
+# do we want to disable xmalloc and friends
+disable_libiberty := @disable_libiberty@
+
+# suck in values for the linking procedure:
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+
+# plugin subdirectories
+plugin_subdirs := @plugin_subdirs@
+
+build_subdirs := ir/adt ir/net ir/debug ir/tv ir/common ir/ident ir/ir \
+ ir/opt ir/tr ir/ana ir/stat ir/ana2 ir/arch ir/lower \
+ $(plugin_subdirs)
+
+ifeq (@enable_external_effects@,yes)
+build_subdirs += ir/external
+endif
+
+ifeq ($(disable_libiberty),yes)
+build_add_lib := libfirm_xmalloc.a
+else
+build_add_lib :=
+endif
+
+subdirs := $(build_subdirs) ir/config
SOURCES := Makefile.in MakeRules.in MakeTargets\
aclocal.m4 config.h.in\
config.guess config.sub configure.in \
- stamp-h.in install-sh
-
-INSTALL_LIBS = libfirm.a
-
-GENFILES := stamp-h config.log config.cache
+ stamp-h.in install-sh README configure
-# init
-ARCHIVEDISTFILES := testprograms/Makefile.in \
- testprograms/array-heap_example.c testprograms/if_example.c \
- testprograms/array-stack_example.c testprograms/if_while_example.c \
- testprograms/call_str_example.c testprograms/inheritance_example.c \
- testprograms/cond_example.c testprograms/irr_cf_example.c \
- testprograms/const_eval_example.c testprograms/irr_loop_example.c \
- testprograms/dead_block_example.c testprograms/memory_example.c \
- testprograms/empty.c testprograms/oo_program_example.c \
- testprograms/global_var_example.c testprograms/three_cfpred_example.c \
- testprograms/if_else_example.c testprograms/while_example.c \
+SHARED_LIB = libfirm.so
-DISTFILES = $(addprefix ../, $(ARCHIVEDISTFILES))
+INSTALL_LIBS = libfirm.a $(build_add_lib)
+GENFILES := stamp-h config.log config.cache
# config.status config.h.in $(srcdir)/stamp-h.in
include $(topdir)/MakeRules
-XOFILES += $(addsuffix /subdir.o, $(subdirs))
+XOFILES += $(addsuffix /subdir.o, $(build_subdirs))
include $(top_srcdir)/MakeTargets
+# add target firmjni if configured with --enable-firmjni
+all: firm
+
+firm: libfirm.a $(build_add_lib)
+
+shared: $(SHARED_LIB)
+
+$(OFILES): config.h Makefile
-all: config.h Makefile libfirm.a
+$(XOFILES): subdir_all
-libfirm.a: subdir_all $(XOFILES) $(OFILES)
- $(AR) $(ARFLAGS) $@.new $(XOFILES) $(OFILES)
- $(RANLIB) $@.new
+libfirm.a: $(XOFILES) $(OFILES)
+ $(AR) $(ARFLAGS) $@.new $^
mv -f $@.new $@
+ $(RANLIB) $@
+
+libfirm_xmalloc.a: subdir_all ir/adt/xmalloc.o
+ $(AR) $(ARFLAGS) $@.new ir/adt/xmalloc.o
+ mv -f $@.new $@
+
+# dont know about xml here
+libfirm.so: $(XOFILES)
+ ld -Bshareable -o ./libfirm.so $(XOFILES) -lm $(LDFLAGS) $(LIBS)
testprograms: libfirm.a
$(MAKE) -C testprograms
+firmjni:: libfirm.a
+ $(MAKE) -C firmjni
-# generate program documentation
+# gernerate program documentation
.PHONY: autodoc
-autodoc: autodoc_xref $(AUTODOCDIR) $(GLOBALXREFFILE) autodoc_html $(INDEXFILE)
-
-$(GLOBALXREFFILE): $(addsuffix /$(LOCALXREFSFILE), $(subdirs)) .xrefs
-# cat $^ > $@
- $(RM) $@
- find $(PWD) -name "*.xref" -print > $@
-
-$(INDEXFILE): $(GLOBALXREFFILE)
- $(AUTODOC) $(GLOBALXREFFILE) $@ INDEX HTML
-
+autodoc: $(DOXYFILE)
+ $(DOXYGEN) $(DOXYFILE)
#${srcdir}/configure: configure.in aclocal.m4
$(srcdir)/configure: configure.in
config.status: configure
./config.status --recheck
+
+# add target test-firmjni if configured with --enable-firmjni
+test::
+ $(MAKE) -C testprograms test;
+
+test-firmjni::
+ $(MAKE) -C firmjni test;
+
+test-reference::
+ $(MAKE) -C testprograms reference;
+
+test-clean:
+ $(MAKE) -C testprograms realclean
+ $(MAKE) -C firmjni/testprograms clean;