aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2004-10-13 05:08:52 +0000
committerH. Peter Anvin <hpa@zytor.com>2004-10-13 05:08:52 +0000
commit0273771dbd5b35fc50d380b5bf96685032ba63d8 (patch)
tree9c2a1ede0ba4ef66841f99f2742d159566ea1bbf
parentfba2f3e52af6b7025a71312a5cfdca78550ee2af (diff)
downloadklibc-0273771dbd5b35fc50d380b5bf96685032ba63d8.tar.gz
Fix dependency generation for non-C files; support separate kernelklibc-0.184
source/obj directories
-rw-r--r--MCONFIG14
-rw-r--r--klibc/MCONFIG2
-rw-r--r--klibc/Makefile6
-rw-r--r--klibc/makeerrlist.pl21
4 files changed, 28 insertions, 15 deletions
diff --git a/MCONFIG b/MCONFIG
index d2aa23626c17f..7da150d031892 100644
--- a/MCONFIG
+++ b/MCONFIG
@@ -6,19 +6,23 @@
# Eventually support separate compilation, but we don't have it yet...
OBJROOT = $(SRCROOT)
+# Kernel trees (source and obj) - can potentially be different
+KRNLSRC = $(SRCROOT)/linux
+KRNLOBJ = $(SRCROOT)/linux
+
ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
CROSS =
CC = $(CROSS)gcc
LD = $(CROSS)ld
KLIBSRC = $(SRCROOT)/klibc
KLIBOBJ = $(OBJROOT)/klibc
-REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include \
- -D__KLIBC__ -DBITSIZE=$(BITSIZE) \
- -I$(SRCROOT)/include/arch/$(ARCH) \
+INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \
-I$(SRCROOT)/include/bits$(BITSIZE) \
-I$(SRCROOT)/include \
- -I$(SRCROOT)/linux/include -I$(SRCROOT)/linux/include2
-
+ -I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include
+REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include \
+ -D__KLIBC__ -DBITSIZE=$(BITSIZE) \
+ $(INCLUDE)
LDFLAGS =
AR = $(CROSS)ar
RANLIB = $(CROSS)ranlib
diff --git a/klibc/MCONFIG b/klibc/MCONFIG
index 5b6eecd037ed5..499b6e8b5649a 100644
--- a/klibc/MCONFIG
+++ b/klibc/MCONFIG
@@ -13,6 +13,6 @@ ifeq ($(ERRLIST),1)
REQFLAGS += -DWITH_ERRLIST
endif
-CFLAGS = -Wp,-MD,$(dir $*).$(notdir $*).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS)
+CFLAGS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS)
SOFLAGS = -fPIC
diff --git a/klibc/Makefile b/klibc/Makefile
index d7e75f181498c..e3907d867a112 100644
--- a/klibc/Makefile
+++ b/klibc/Makefile
@@ -120,14 +120,14 @@ crt0.o: arch/$(ARCH)/crt0.o
cp arch/$(ARCH)/crt0.o .
errlist.c:
- $(PERL) makeerrlist.pl -errlist > $@ || rm -f $@
+ $(PERL) makeerrlist.pl $(INCLUDE) -errlist > $@ || rm -f $@
# We pass -ansi to keep cpp from define e.g. "i386" as well as "__i386__"
SYSCALLS.i: SYSCALLS.def
$(CC) $(CFLAGS) -D__ASSEMBLY__ -ansi -x assembler-with-cpp -E -o $@ $<
-syscalls.nrs: ../include/sys/syscall.h ../include/arch/$(ARCH)/klibc/archsys.h ../linux/include/asm/unistd.h
- $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ ../include/sys/syscall.h
+syscalls.nrs: $<
+ $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ $<
syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscalls.nrs
rm -rf syscalls
diff --git a/klibc/makeerrlist.pl b/klibc/makeerrlist.pl
index f42704f88a3b8..14498d880a9e2 100644
--- a/klibc/makeerrlist.pl
+++ b/klibc/makeerrlist.pl
@@ -10,20 +10,27 @@ use FileHandle;
%errors = ();
%errmsg = ();
$maxerr = -1;
-$rootdir = '../linux/include/'; # Must have trailing /
+@includelist = (); # Include directories
sub parse_file($) {
my($file) = @_;
my($fh) = new FileHandle;
my($line, $error, $msg);
my($kernelonly) = 0;
-
- $file = $rootdir.$file;
+ my($root);
print STDERR "opening $file\n" unless ( $quiet );
- if ( !($fh->open("< ".$file)) ) {
- die "$0: cannot open $file\n";
+ $ok = 0;
+ foreach $root ( @includelist ) {
+ if ( $fh->open($root.'//'.$file, '<') ) {
+ $ok = 1;
+ last;
+ }
+ }
+
+ if ( ! $ok ) {
+ die "$0: Cannot find file $file\n";
}
while ( defined($line = <$fh>) ) {
@@ -61,8 +68,10 @@ foreach $arg ( @ARGV ) {
$quiet = 1;
} elsif ( $arg =~ /^-(errlist|errnos|maxerr)$/ ) {
$type = $arg;
+ } elsif ( $arg =~ '^\-I' ) {
+ push(@includelist, "$'");
} else {
- die "$0: Unknown option: $arg\n";
+ die "$0: Unknown option: $arg\n";
}
}