summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2006-01-31 09:21:05 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:31 +0200
commit628071290756dc92152bbfda3a61d5db055f88b5 (patch)
treecd45f97af92ab1ca0da06c9b872d3917e0c79e3f
parent098c41348b78edc23841f52a6d394145243efb13 (diff)
2006-01-31 Thomas Schwinge <tschwinge@gnu.org>
Cleanup of GNU Mach's build system. The system dependend parts are now handeled by the respective Makefile and no longer by the top-level one. * configure, i386/configure, i386/linux/configure, linux/configure: Regenerated. * Makefile.in: Various cleanups. (mach/machine, mach_machine): Targets removed. (AWK, CC, CFLAGS, CPPFLAGS, DEFINES, INCLUDES, INSTALL, INSTALL_DATA) (INSTALL_PROGRAM, LD, MIG, MIGFLAGS, NM): Variables moved into Makerules.in. Do not include $(sysdep)/Makefrag anymore. (all, check, clean, distclean, mostlyclean, maintainer-clean, install) (install-headers, install-kernel): Recurse into the system dependend subdirectory. (check): Add a basic test using mbchk. (clean, distclean): Be more explicit in what to delete. ($(systype)/%): New target. (kernel.o): Incorporate the system dependend archive. (installed-sysdep-headers-names, $(installed-sysdep-headers-names)): Variable and target moved into the system dependend Makefile.in. (install-headers, mkheaderdirs): Don't care for the system dependend header files. (%.symc, %.symc.o, %.h, %_user.c, %_interface.h, %_server.c): Targets moved into Makerules.in. Inclusion of dependency files: Likewise. (%.migs_d, %.migu_d, %.migsh_d, %.miguh_d, make-deps, %.d): Likewise. Include Makerules. * Makerules.in: New file, mainly based on Makefile.in. * configure.in: Do not substitute cross_compiling and not explicitly substitute LDFLAGS. Check for cpp, ranlib, ar and mbchk. Care for the mach/machine symbolic link. Add Makerules as a config file. * i386/Makefile.in: Various cleanups. Merge i386/Makefrag and the system dependent stuff from Makefile.in into this file. (all, check, install, install-headers, install-kernel): Recurse into the system dependend subdirectory. (sysdep.o): transformed to the new target sysdep.a. (linux/linux.o): Target removed. (clean, distclean): Be more explicit in what to delete. (linux/%): New target. (install-headers): Install the system dependend header files. (mkheaderdirs): New target. Include the top-level Makerules. * i386/Makefrag: File removed. * i386/Makerules.in: New file. * i386/configure.in: Synchronize AC_INIT to the top-level definition. Do not check for ld and make. Add Makerules as a config file. * i386/linux/Makefile.in: Various cleanups. Replace linux-objs with objfiles. (check, install, install-headers, install-kernel): New empty targets. Don't care about linux-flags if no_deps is true. Inclusion of dependency files removed and instead... Include the top-level Makerules. * i386/linux/Makerules.in: New file. * i386/linux/configure.ac: Synchronize AC_INIT to the top-level definition. Do not check for gcc and ld. Do not explicitly substitute LDFLAGS. Add Makerules as a config file. * linux/configure.in: Synchronize AC_INIT to the top-level definition. Do not create directories using a dummy file. * linux/dummy.in: File removed. * ddb/db_access.h: Include <machine/vm_param.h> instead of "vm_param.h". * kern/bootstrap.c: Likewise. * kern/thread.c: Likewise. * vm/vm_kern.c: Likewise. * vm/vm_object.c: Likewise. * vm/vm_resident.c: Likewise.
-rw-r--r--Makerules.in159
-rw-r--r--configure.in18
2 files changed, 171 insertions, 6 deletions
diff --git a/Makerules.in b/Makerules.in
new file mode 100644
index 0000000..b556363
--- /dev/null
+++ b/Makerules.in
@@ -0,0 +1,159 @@
+# Makerules
+# Copyright 2006 Free Software Foundation, Inc.
+#
+# Permission to use, copy, modify and distribute this software and its
+# documentation is hereby granted, provided that both the copyright
+# notice and this permission notice appear in all copies of the
+# software, derivative works or modified versions, and any portions
+# thereof, and that both notices appear in supporting documentation.
+#
+# THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS
+# "AS IS" CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY
+# LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
+# USE OF THIS SOFTWARE.
+
+
+#
+# configure's findings.
+#
+
+systype = @systype@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+
+AR = @AR@
+AWK = @AWK@
+CC = @CC@
+CPP = @CPP@
+LD = @LD@
+MBCHK = @MBCHK@
+MIG = @MIG@
+NM = @NM@
+RANLIB = @RANLIB@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+CFLAGS-common = @CFLAGS@
+CPPFLAGS-common = @CPPFLAGS@
+DEFS-common = @DEFS@
+LDFLAGS-common = @LDFLAGS@
+
+
+#
+# System dependent Makerules
+#
+
+include $(abs_top_builddir)/$(systype)/Makerules
+
+
+#
+# Compilation flags
+#
+
+DEFS += $(DEFS-common)
+
+DEFINES += $(DEFS) -DMACH -DCMU -DMACH_KERNEL -DKERNEL
+
+INCLUDES += -I$(abs_top_builddir) -I$(abs_top_srcdir) \
+ -I$(abs_top_srcdir)/include -I$(abs_top_srcdir)/$(systype) \
+ -I$(abs_top_srcdir)/$(systype)/include/mach/sa \
+ -I$(abs_top_srcdir)/bogus -I$(abs_top_srcdir)/util \
+ -I$(abs_top_srcdir)/kern -I$(abs_top_srcdir)/device
+
+CPPFLAGS += -nostdinc $(DEFINES) $(INCLUDES) $(CPPFLAGS-common)
+
+MIGFLAGS += $(CPPFLAGS)
+
+CFLAGS += $(CFLAGS-common)
+
+LDFLAGS += $(LDFLAGS-common)
+
+# Assemble .S files correctly
+ASFLAGS += -DASSEMBLER
+
+
+#
+# How to do some things
+#
+
+# Building foo.h from foo.sym:
+%.symc: %.sym $(abs_top_srcdir)/gensym.awk
+ $(AWK) -f $(word 2,$^) $< > $@
+%.symc.o: %.symc
+ $(CC) -S $(CPPFLAGS) $(CFLAGS) $(CPPFLAGS-$@) -x c -o $@ $<
+%.h: %.symc.o
+ sed <$< -e 's/^[^*].*$$//' | \
+ sed -e 's/^[*]/#define/' -e 's/mAgIc[^-0-9]*//' >$@
+
+# Building from foo.cli
+%.h %_user.c: %.cli
+ $(MIG) $(MIGFLAGS) -header $*.h -user $*_user.c -server /dev/null $<
+
+# Building from foo.srv
+%_interface.h %_server.c: %.srv
+ $(MIG) $(MIGFLAGS) -sheader $*_interface.h -server $*_server.c \
+ -header /dev/null -user /dev/null $<
+
+#
+# Dependency generation
+#
+
+# Include dependency files
+ifneq ($(no_deps),t)
+
+# For each file generated by MiG we need a .d file.
+-include $(subst _server.o,.migs_d,$(servers)) /dev/null
+-include $(subst _server.o,.migsh_d,$(servers)) /dev/null
+
+# vm_user.o fits the pattern, but is not actually a MiG-related file.
+-include $(subst _user.o,.migu_d,$(users)) /dev/null
+-include $(subst _user.o,.miguh_d,$(users)) /dev/null
+
+# For each .o file we need a .d file.
+-include $(subst .o,.d,$(filter %.o,$(objfiles))) /dev/null
+
+endif
+
+# Here is how to make those dependency files
+
+%.migs_d: %.srv
+ (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \
+ sed -e 's/[^:]*:/$(@:.migs_d=_server.c) $@:/' > $@)
+
+%.migu_d: %.cli
+ (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \
+ sed -e 's/[^:]*:/$(@:.migu_d=_user.c) $@:/' > $@)
+
+%.migsh_d: %.migs_d
+ sed -e 's/_server\.c /_interface.h /' -e 's/migs_d/migsh_d/' < $< > $@
+
+%.miguh_d: %.migu_d
+ sed -e 's/_user\.c /.h /' -e 's/migu_d/miguh_d/' < $< > $@
+
+# Generic rule for $(CC) based compilation for making dependencies
+define make-deps
+set -e; $(CC) $(CFLAGS) $(CPPFLAGS) -M -MG $< | \
+ sed > $@.new -e 's/$*\.o:/$*.o $@:/'
+mv -f $@.new $@
+endef
+
+%.d: %.c; $(make-deps)
+%.d: %.S; $(make-deps)
+
+# .s files don't go through the preprocessor, so we do this
+# This rule must come *after* the genuine ones above, so that
+# make doesn't build a .s file and then make an empty dependency
+# list.
+%.d: %.s
+ echo '$*.o: $<' > $@
+
+
+#
+# Autoconf support
+#
+
+$(top_builddir)/Makerules $(abs_top_builddir)/Makerules: \
+ $(abs_top_srcdir)/Makerules.in $(abs_top_builddir)/config.status
+ cd $(abs_top_builddir) && ./config.status $(@F)
diff --git a/configure.in b/configure.in
index b6691f5..2f631e2 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
dnl Configure script for GNU Mach.
-dnl Copyright 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
+dnl Copyright 1997, 1998, 1999, 2004, 2006 Free Software Foundation, Inc.
dnl Permission to use, copy, modify and distribute this software and its
dnl documentation is hereby granted, provided that both the copyright
@@ -29,7 +29,6 @@ i[[3456]]86) systype=i386 ;;
esac
AC_SUBST([systype])
-AC_SUBST([cross_compiling])
# Default prefix is / for the kernel.
AC_PREFIX_DEFAULT([])
@@ -53,15 +52,22 @@ AS_HELP_STRING([--enable-kmsg], [enable use of kmsg device [[default=yes]]]),
AC_PROG_INSTALL
AC_PROG_AWK
AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_RANLIB
+AC_CHECK_TOOL([AR], [ar])
AC_CHECK_TOOL([LD], [ld])
-AC_SUBST([LDFLAGS])
AC_CHECK_TOOL([NM], [nm])
AC_CHECK_TOOL([MIG], [mig], [mig])
-# Set up `machine' link in build directory for easier header file location.
-AC_CONFIG_LINKS([machine:${systype}/${systype}])
+AC_CHECK_PROG([MBCHK], [mbchk], [mbchk], :)
+
+# Set up `machine' and `mach/machine' links in the build directory for easier
+# header file location.
+AC_CONFIG_LINKS([machine:${systype}/${systype}
+ mach/machine:${systype}/include/mach/${systype}])
+
AC_CONFIG_SUBDIRS([linux])
@@ -71,5 +77,5 @@ if test "$systype" = i386; then
AC_CONFIG_SUBDIRS([i386])
fi
-AC_CONFIG_FILES([Makefile version.c doc/Makefile])
+AC_CONFIG_FILES([Makefile Makerules version.c doc/Makefile])
AC_OUTPUT