On Sat, Sep 10, 2005 at 11:01:22PM +0200, I wrote: > [...] > The problem is basically that the whole build is driven by the > "all-architectures" Makefile, which doen't know about the architecture > specific configure options, which `--enable-lpr' is (the only one, > though). > > Fixing that issue properly isn't quite easy: GNU Mach's build system > needs to be reordered a bit.
I finally got around to do and test that. > I already began to deal with that task; I'll continue if there is > interest in applying that patch. That'll be my thing to decide now, after I considered your comments. ;-) The following patch is a basis for preparing GNU Mach's build system to have more independent stages, e.g. untangle the current Linux glue code from the core Mach code. > I started by moving the architecture specific rules from > [GNU Mach]/Makefile and the whole of [GNU Mach]/i386/Makefrag into > [GNU Mach]/i386/Makefile, shared functions into [GNU Mach]/Makerules, > making [GNU Mach]/i386/Makefile build the architecture specific object > files and Linux's drivers and store them as [GNU Mach]/i386/sysdep.o, > which in turn is used by [GNU Mach]/Makefile to build the kernel image > from that file and the architecture independent ones. This basically remains what the patch does. I tested it both with and without enabling the kernel debugger, compiling in all drivers that are available at the moment. Is this ok for everyone to be applied? 2006-01-28 Thomas Schwinge <[EMAIL PROTECTED]> * Makefile.in: Various cleanups. Do not include $(sysdep)/Makefrag anymore. Move shared and system dependent stuff out of this file. Include Makerules. * Makerules.in: New file, mainly based on Makefile.in. * configure.in: Check for cpp and ranlib and ar. 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. Don't build sysdep.o, but sysdep.a. Include the top-level Makerules. * i386/Makefrag: Removed. * i386/Makerules: New file. * i386/linux/Makerules: New file. * 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. Index: Makefile.in =================================================================== RCS file: /cvsroot/hurd/gnumach/Makefile.in,v retrieving revision 1.31.2.2 diff -u -r1.31.2.2 Makefile.in --- Makefile.in 12 Jul 2005 23:01:06 -0000 1.31.2.2 +++ Makefile.in 28 Jan 2006 14:01:01 -0000 @@ -1,5 +1,5 @@ # Makefile for Mach 4 kernel directory -# Copyright 1997, 1999, 2004 Free Software Foundation, Inc. +# Copyright 1997, 1999, 2004, 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 @@ -12,24 +12,29 @@ # LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE # USE OF THIS SOFTWARE. - +# +# configure's findings. +# -# Variables from `configure'. [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ +srcdir = @srcdir@ version = @PACKAGE_VERSION@ -exec_prefix=$(prefix) +systype = @systype@ -bootdir=$(exec_prefix)/boot -includedir=$(prefix)/include -libexecdir=$(exec_prefix)/libexec -bindir=$(exec_prefix)/bin +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bootdir = $(exec_prefix)/boot +includedir = @includedir@ -sysdep = $(srcdir)/$(systype) + +# +# Default target +# +all: + + # Detect if the user wants KDB ifeq ($(findstring -DMACH_KDB,@DEFS@),-DMACH_KDB) enable_kdb=yes @@ -44,21 +49,6 @@ enable_kmsg=no endif -# Programs found by configure. -AWK = @AWK@ -INSTALL = @INSTALL@ -CC = @CC@ -LD = @LD@ -NM = @NM@ -MIG = @MIG@ - -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -CFLAGS = @CFLAGS@ - -all: - # All the possible architectures all-archs = i386 linux @@ -171,8 +161,7 @@ debian-files = changelog control copyright README.Debian rules postinst prerm -# Object files that go into the kernel image. (This will be augmented by the -# machine dependent Makefile fragment.) +# Object files that go into the kernel image. # Basic kernel source for Mach objfiles := $(subst .c,.o,$(ipc-cfiles) $(kern-cfiles) \ @@ -246,35 +235,6 @@ vpath %.cli $(srcdir)/vm $(srcdir)/device vpath %.srv $(srcdir)/device $(srcdir)/ipc $(srcdir)/kern - -# We need this symlink in place before we start compiling, -# so <mach/machine/foo.h> headers can be found. -before-compile = mach/machine -mach/machine: mach_machine - test -d $(@D) || mkdir $(@D) - rm -f $@ - ln -s ../mach_machine mach/machine -mach_machine: - rm -f $@ - ln -s $(srcdir)/$(systype)/include/mach/$(systype) mach_machine - - - -# -# Compilation flags -# - -DEFINES += -DMACH -DCMU -DMACH_KERNEL -DKERNEL @DEFS@ -INCLUDES += -I. -I$(srcdir) -I$(srcdir)/include \ - -I$(srcdir)/bogus -I$(srcdir)/util -I$(srcdir)/kern -I$(srcdir)/device - - -include $(sysdep)/Makefrag - -CPPFLAGS += -nostdinc $(DEFINES) $(INCLUDES) - -MIGFLAGS += $(CPPFLAGS) - # Standard targets @@ -309,8 +269,9 @@ #kernel.a: $(objfiles) # @rm -f $@ # $(AR) cq $@ $^ -kernel.o: $(objfiles) # kernel.a - $(LD) -r -o $@ $^ +kernel.o: $(objfiles) $(systype)/sysdep.a # kernel.a + $(LD) -r -o $@ $(kernel-objfiles-prepend) \ + $(filter-out $(kernel-objfiles-prepend),$^) kernel-undef: kernel.o $(NM) -u $< | sed 's/ *U *//;s/^_*//' | sort -u > $@ kernel-undef-bad: kernel-undef Makefile @@ -330,24 +291,20 @@ # Installation # installed-headers-names = $(addprefix $(includedir)/,$(installed-headers)) -installed-sysdep-headers-names = $(addprefix $(includedir)/,$($(systype)-installed-headers)) install: install-headers install-kernel $(installed-headers-names): $(includedir)/%: $(srcdir)/include/% $(INSTALL_DATA) $< $@ -$(installed-sysdep-headers-names): $(includedir)/%: $(sysdep)/include/% - $(INSTALL_DATA) $< $@ - -install-headers: mkheaderdirs $(installed-headers-names) $(installed-sysdep-headers-names) - ln -sf $(systype) $(includedir)/mach/machine +install-headers: mkheaderdirs $(installed-headers-names) + make -C $(systype) $@ install-kernel: kernel mkkerneldirs $(INSTALL_PROGRAM) kernel $(bootdir)/gnumach + make -C $(systype) $@ mkheaderdirs: - mkdir -p $(includedir) $(includedir)/device $(includedir)/mach \ - $(includedir)/mach/$(systype) $(includedir)/mach/exec + mkdir -p $(includedir) $(includedir)/device $(includedir)/mach/exec mkkerneldirs: mkdir -p $(bootdir) @@ -397,7 +354,6 @@ rm -rf gnumach-$(version) - # # Autoconf support # @@ -407,7 +363,7 @@ cd $(srcdir) && autoheader Makefile: $(srcdir)/Makefile.in config.status - ./config.status + ./config.status $@ config.h: stamp-configh ; stamp-configh: $(srcdir)/config.h.in config.status ./config.status @@ -420,80 +376,8 @@ vpath configure $(srcdir) - -# -# How to do some things -# - -# Building foo.h from foo.sym: -%.symc: %.sym $(srcdir)/gensym.awk - $(AWK) -f $(word 2,$^) $< > $@ -%.symc.o: %.symc $(before-compile) - $(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 $(before-compile) - $(MIG) $(MIGFLAGS) -header $*.h -user $*_user.c -server /dev/null $< - -# Building from foo.srv -%_interface.h %_server.c: %.srv $(before-compile) - $(MIG) $(MIGFLAGS) -sheader $*_interface.h -server $*_server.c \ - -header /dev/null -user /dev/null $< - # -# Dependency generation +# Makerules # -# Include dependency files -ifneq ($(no_deps),t) - -# For each file generated by MiG we need a .d file. -servers = $(filter %_server.o,$(objfiles)) --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. -users = $(filter-out vm_user.o,$(filter %_user.o,$(objfiles))) --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 $(before-compile) - (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \ - sed -e 's/[^:]*:/$(@:.migs_d=_server.c) $@:/' > $@) - -%.migu_d: %.cli $(before-compile) - (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 > [EMAIL PROTECTED] -e 's/$*\.o:/$*.o $@:/' -mv -f [EMAIL PROTECTED] $@ -endef - -%.d: %.c $(before-compile); $(make-deps) -%.d: %.S $(before-compile); $(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: $<' > $@ +include Makerules Index: configure.in =================================================================== RCS file: /cvsroot/hurd/gnumach/configure.in,v retrieving revision 1.12.2.1 diff -u -r1.12.2.1 configure.in --- configure.in 12 Jul 2005 23:01:06 -0000 1.12.2.1 +++ configure.in 28 Jan 2006 14:01:03 -0000 @@ -53,9 +53,11 @@ 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]) @@ -71,5 +73,5 @@ AC_CONFIG_SUBDIRS([i386]) fi -AC_CONFIG_FILES([Makefile version.c doc/Makefile]) +AC_CONFIG_FILES([Makefile Makerules version.c doc/Makefile]) AC_OUTPUT Index: ddb/db_access.h =================================================================== RCS file: /cvsroot/hurd/gnumach/ddb/Attic/db_access.h,v retrieving revision 1.2 diff -u -r1.2 db_access.h --- ddb/db_access.h 5 Apr 2001 06:39:19 -0000 1.2 +++ ddb/db_access.h 28 Jan 2006 14:01:03 -0000 @@ -33,7 +33,7 @@ #include <mach/boolean.h> #include <machine/db_machdep.h> #include <ddb/db_task_thread.h> -#include "vm_param.h" +#include <machine/vm_param.h> /* implementation dependent access capability */ #define DB_ACCESS_KERNEL 0 /* only kernel space */ Index: i386/Makefile.in =================================================================== RCS file: /cvsroot/hurd/gnumach/i386/Attic/Makefile.in,v retrieving revision 1.2 diff -u -r1.2 Makefile.in --- i386/Makefile.in 20 Jul 1999 18:34:02 -0000 1.2 +++ i386/Makefile.in 28 Jan 2006 14:01:10 -0000 @@ -1,5 +1,5 @@ # Makefile for i386 -# Copyright 1999 Free Software Foundation, Inc. +# Copyright 1999, 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 @@ -12,58 +12,172 @@ # LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE # USE OF THIS SOFTWARE. + +# +# configure's findings. +# + +srcdir = @srcdir@ +# Hm. +top_srcdir = @top_srcdir@/.. +top_builddir = @[EMAIL PROTECTED]/ + +prefix = @prefix@ +includedir = @includedir@ + + +# +# Default target +# + +all: + + +# Detect if the user wants LPR +ifeq ($(findstring -DMACH_LPR,@DEFS@),-DMACH_LPR) +enable_lpr=yes +else +enable_lpr=no +endif + + +# i386 Mach makefile fragment +# Copyright 1997, 1999 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. + + +# Source files for any i386 kernel +i386at-files = autoconf.c blit.c conf.c cons_conf.c fd.c rtc.c \ + i386at_ds_routines.c immc.c int_init.c iopl.c kd.c kd_event.c \ + kd_mouse.c kd_queue.c model_dep.c phys_mem_grab_page.c pic_isa.c +i386-files = ast_check.c db_disasm.c db_interface.c db_trace.c debug_i386.c \ + fpe_linkage.c fpu.c gdt.c hardclock.c idt.c io_emulate.c io_map.c \ + iopb.c ktss.c kttd_interface.c ldt.c loose_ends.c mp_desc.c pcb.c \ + phys.c pic.c pit.c seg.c trap.c user_ldt.c +intel-files = pmap.c read_fault.c + +# Assembler source +i386at-Sfiles = boothdr.S interrupt.S kdasm.S +i386-Sfiles = cswitch.S debug_trace.S idt_inittab.S locore.S spl.S + +# Account for them in the image +objfiles += $(subst .c,.o,$(i386at-files) $(i386-files) $(intel-files)) \ + $(subst .S,.o,$(i386at-Sfiles) $(i386-Sfiles)) +vpath %.c $(srcdir)/i386at $(srcdir)/i386 $(srcdir)/intel +vpath %.S $(srcdir)/i386at $(srcdir)/i386 + +# Files from the generic source that we want +objfiles += busses.o cirbuf.o +# Hm. +vpath busses.c $(top_srcdir)/chips +vpath cirbuf.c $(top_srcdir)/device + +# Mig-generated +objfiles += mach_i386_server.o + +# This file is only needed for KDB support. It'll be discarded at linking if +# it's not needed. +objfiles += _setjmp.o + +# XXX: In i386, com is always enabled. +objfiles += com.o + +# This file is only needed for LPR support. +ifeq ($(enable_lpr),yes) +objfiles += lpr.o +endif -# Variables from `configure'. [EMAIL PROTECTED]@ +# Where to find some things +vpath i386asm.sym $(srcdir)/i386 +vpath mach_i386.srv $(srcdir)/i386 + +# Our include files are here; make sure they PRECEDE the generic ones. +INCLUDES := -I. -I$(srcdir)/i386at -I$(srcdir)/i386 \ + -I$(srcdir)/include -I$(srcdir)/include/mach/sa \ + -I$(srcdir)/bogus -I$(srcdir) $(INCLUDES) -# Programs found by configure. -LD = @LD@ -MAKE = @MAKE@ + +# +# Rules. +# -# Rules. There are few rules because Makefrag does most things in i386. -all: sysdep.o +all: sysdep.a -sysdep.o: linux/linux.o $(srcdir)/configure +# `boothdr.o' is special. +sysdep.a: $(objfiles) linux/linux.o rm -f $@ - $(LD) -r -o $@ linux/linux.o + $(AR) cr $@ $(filter-out boothdr.o,$^) + $(RANLIB) $@ -linux/linux.o: FORCE - cd linux && $(MAKE) all +linux/%: FORCE + cd linux && $(MAKE) $(@F) FORCE: clean: - rm -f sysdep.o - cd linux && $(MAKE) clean + rm -f sysdep.a $(objfiles) + cd linux && $(MAKE) $@ distclean: clean - cd linux && $(MAKE) distclean + cd linux && $(MAKE) $@ rm -f config.status config.log Makefile mostlyclean: distclean - cd linux && $(MAKE) mostlyclean + cd linux && $(MAKE) $@ maintainer-clean: mostlyclean rm -f $(srcdir)/configure - cd linux && $(MAKE) maintainer-clean + cd linux && $(MAKE) $@ + +installed-headers = $(addprefix mach/i386/, \ + asm.h boolean.h disk.h eflags.h exception.h fp_reg.h ioccom.h \ + kern_return.h mach_i386.defs mach_i386_types.h machine_types.defs \ + multiboot.h rpc.h syscall_sw.h thread_status.h trap.h vm_param.h \ + vm_types.h) + +installed-headers-names = $(addprefix $(includedir)/,$(installed-headers)) +$(installed-headers-names): $(includedir)/%: $(srcdir)/include/% + $(INSTALL_DATA) $< $@ + +install-headers: mkheaderdirs $(installed-headers-names) + ln -sfn $(systype) $(includedir)/mach/machine -install-headers: install-kernel: +mkheaderdirs: + mkdir -p $(includedir)/mach/$(systype) - +# # Autoconf support +# $(srcdir)/configure: configure.in cd $(srcdir) && autoconf Makefile: Makefile.in config.status - ./config.status + ./config.status $@ config.status: configure ./config.status --recheck vpath %.in $(srcdir) vpath configure $(srcdir) + + +# +# Makerules +# + +include $(top_builddir)Makerules cvs diff: cannot find i386/Makefrag Index: kern/bootstrap.c =================================================================== RCS file: /cvsroot/hurd/gnumach/kern/bootstrap.c,v retrieving revision 1.12 diff -u -r1.12 bootstrap.c --- kern/bootstrap.c 5 Mar 2002 21:31:24 -0000 1.12 +++ kern/bootstrap.c 28 Jan 2006 14:01:12 -0000 @@ -34,7 +34,7 @@ #include <mach/port.h> #include <mach/message.h> -#include "vm_param.h" +#include <machine/vm_param.h> #include <ipc/ipc_port.h> #include <kern/host.h> #include <kern/task.h> Index: kern/thread.c =================================================================== RCS file: /cvsroot/hurd/gnumach/kern/thread.c,v retrieving revision 1.3 diff -u -r1.3 thread.c --- kern/thread.c 20 Aug 1997 20:31:30 -0000 1.3 +++ kern/thread.c 28 Jan 2006 14:01:12 -0000 @@ -46,7 +46,7 @@ #include <mach/thread_special_ports.h> #include <mach/thread_status.h> #include <mach/time_value.h> -#include "vm_param.h" +#include <machine/vm_param.h> #include <kern/ast.h> #include <kern/counters.h> #include <kern/ipc_tt.h> Index: vm/vm_kern.c =================================================================== RCS file: /cvsroot/hurd/gnumach/vm/vm_kern.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 vm_kern.c --- vm/vm_kern.c 25 Feb 1997 21:28:36 -0000 1.1.1.1 +++ vm/vm_kern.c 28 Jan 2006 14:01:15 -0000 @@ -35,7 +35,7 @@ */ #include <mach/kern_return.h> -#include "vm_param.h" +#include <machine/vm_param.h> #include <kern/assert.h> #include <kern/lock.h> #include <kern/thread.h> Index: vm/vm_object.c =================================================================== RCS file: /cvsroot/hurd/gnumach/vm/vm_object.c,v retrieving revision 1.2 diff -u -r1.2 vm_object.c --- vm/vm_object.c 24 Mar 1997 21:52:54 -0000 1.2 +++ vm/vm_object.c 28 Jan 2006 14:01:15 -0000 @@ -43,7 +43,7 @@ #include <mach/memory_object.h> #include "memory_object_default.h" #include "memory_object_user.h" -#include "vm_param.h" +#include <machine/vm_param.h> #include <ipc/ipc_port.h> #include <ipc/ipc_space.h> #include <kern/assert.h> Index: vm/vm_resident.c =================================================================== RCS file: /cvsroot/hurd/gnumach/vm/vm_resident.c,v retrieving revision 1.7 diff -u -r1.7 vm_resident.c --- vm/vm_resident.c 4 Sep 1999 13:03:32 -0000 1.7 +++ vm/vm_resident.c 28 Jan 2006 14:01:15 -0000 @@ -40,7 +40,7 @@ #include <kern/task.h> #include <kern/thread.h> #include <mach/vm_statistics.h> -#include "vm_param.h" +#include <machine/vm_param.h> #include <kern/xpr.h> #include <kern/zalloc.h> #include <vm/pmap.h> --- /dev/null 2006-01-20 10:59:02.777470736 +0100 +++ Makerules.in 2006-01-28 14:55:52.000000000 +0100 @@ -0,0 +1,174 @@ +# 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@ +MIG = @MIG@ +NM = @NM@ +RANLIB = @RANLIB@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +DEFS = @DEFS@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ + + +# +# Compilation flags +# + +DEFINES += -DMACH -DCMU -DMACH_KERNEL -DKERNEL $(DEFS) + +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) + +MIGFLAGS += $(CPPFLAGS) + +# Assemble .S files correctly +ASFLAGS += -DASSEMBLER + + +# We need this symlink in place before we start compiling, +# so <mach/machine/foo.h> headers can be found. + +before-compile = $(abs_top_builddir)/mach/machine + +$(abs_top_builddir)/mach/machine: $(abs_top_builddir)/mach_machine + test -d $(@D) || mkdir $(@D) + rm -f $@ + ln -s ../mach_machine mach/machine + +$(abs_top_builddir)/mach_machine: + rm -f $@ + ln -s $(abs_top_srcdir)/$(systype)/include/mach/$(systype) mach_machine + + +# +# How to do some things +# + +# Building system dependent files: +$(systype)/%: FORCE + $(MAKE) -C $(systype) $(@F) +FORCE: + +# Building foo.h from foo.sym: +%.symc: %.sym $(abs_top_srcdir)/gensym.awk + $(AWK) -f $(word 2,$^) $< > $@ +%.symc.o: %.symc $(before-compile) + $(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 $(before-compile) + $(MIG) $(MIGFLAGS) -header $*.h -user $*_user.c -server /dev/null $< + +# Building from foo.srv +%_interface.h %_server.c: %.srv $(before-compile) + $(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. +servers = $(filter %_server.o,$(objfiles)) +-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. +users = $(filter-out vm_user.o,$(filter %_user.o,$(objfiles))) +-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 $(before-compile) + (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \ + sed -e 's/[^:]*:/$(@:.migs_d=_server.c) $@:/' > $@) + +%.migu_d: %.cli $(before-compile) + (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 > [EMAIL PROTECTED] -e 's/$*\.o:/$*.o $@:/' +mv -f [EMAIL PROTECTED] $@ +endef + +%.d: %.c $(before-compile); $(make-deps) +%.d: %.S $(before-compile); $(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 +# + +Makerules $(abs_top_builddir)/Makerules: $(abs_top_srcdir)/Makerules.in $(abs_top_builddir)/config.status + cd $(abs_top_builddir) && ./config.status $(@F) + + + +# +# System dependent Makerules +# + +include $(abs_top_srcdir)/$(systype)/Makerules --- /dev/null 2006-01-20 10:59:02.777470736 +0100 +++ i386/Makerules 2006-01-28 14:09:01.000000000 +0100 @@ -0,0 +1,28 @@ +# i386/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. + + +# Some of the i386-specific code checks for these. +DEFINES += -DCONTINUATIONS -D__ELF__ -Di386 + +# Arrange for a suitable load address. +LDFLAGS += -Ttext 100000 + +# `boothdr.o' has to be at the beginning. +kernel-objfiles-prepend = $(systype)/boothdr.o + +kernel.o: $(kernel-objfiles-prepend) + + +include $(abs_top_srcdir)/$(systype)/linux/Makerules --- /dev/null 2006-01-20 10:59:02.777470736 +0100 +++ i386/linux/Makerules 2006-01-28 11:02:10.000000000 +0100 @@ -0,0 +1,16 @@ +# i386/linux/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. + + +DEFINES += -DLINUX_DEV Regards, Thomas _______________________________________________ Bug-hurd mailing list Bug-hurd@gnu.org http://lists.gnu.org/mailman/listinfo/bug-hurd