aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-04-27 21:42:45 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-04-27 21:42:45 -0700
commite6d94cc986897ac80a13a5eedd8ab38d581b0453 (patch)
treee6a9bab1f51a0eb4274e9dc77465f9cf3941e160
parent593236b4086e21f9552bb0281f6093b7cce875e9 (diff)
downloadlwip-e6d94cc986897ac80a13a5eedd8ab38d581b0453.tar.gz
lwip-e6d94cc986897ac80a13a5eedd8ab38d581b0453.tar.xz
lwip-e6d94cc986897ac80a13a5eedd8ab38d581b0453.zip
Unify dependency generation: MCONFIG.embedded
Unify dependency generation and move common rules into MCONFIG.embedded. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--MCONFIG.embedded12
-rw-r--r--core/Makefile2
-rw-r--r--dos/Makefile11
-rw-r--r--mbr/Makefile6
-rw-r--r--memdisk/Makefile58
-rw-r--r--memdisk/memdisk.inc4
-rw-r--r--memdump/Makefile10
-rw-r--r--modules/Makefile11
-rw-r--r--sample/Makefile11
9 files changed, 41 insertions, 84 deletions
diff --git a/MCONFIG.embedded b/MCONFIG.embedded
index fee374f7..586afc3e 100644
--- a/MCONFIG.embedded
+++ b/MCONFIG.embedded
@@ -28,8 +28,18 @@ GCCOPT := $(call gcc_ok,-m32,) \
LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
LD += -m elf_i386
-CFLAGS = $(GCCOPT) -g -W -Wall $(OPTFLAGS) $(INCLUDES)
+CFLAGS = $(GCCOPT) -g -W -Wall -Wno-sign-compare $(OPTFLAGS) $(INCLUDES)
SFLAGS = $(CFLAGS) -D__ASSEMBLY__
.SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss
+%.o: %.c
+ $(CC) $(MAKEDEPS) $(CFLAGS) -c -o $@ $<
+%.i: %.c
+ $(CC) $(MAKEDEPS) $(CFLAGS) -E -o $@ $<
+%.s: %.c
+ $(CC) $(MAKEDEPS) $(CFLAGS) -S -o $@ $<
+%.o: %.S
+ $(CC) $(MAKEDEPS) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<
+%.s: %.S
+ $(CC) $(MAKEDEPS) $(SFLAGS) -E -o $@ $<
diff --git a/core/Makefile b/core/Makefile
index 1bd13e75..eeca0c58 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -72,7 +72,7 @@ iso%.bin: iso%.elf checksumiso.pl
$(OBJCOPY) -O binary $< $@
%.o: %.asm kwdhash.gen ../version.gen
- ( $(NASM) -DDEPEND $(NINCLUDE) -o $@ -M $< && echo '' ) > .$@.d; true
+ ( $(NASM) -DDEPEND $(NINCLUDE) -o $@ -M $< ; echo '' ) > .$@.d; true
$(NASM) $(NASMOPT) -f elf -g -F stabs -DDATE_STR="'$(DATE)'" \
-DHEXDATE="$(HEXDATE)" \
-l $(@:.o=.lsr) -o $@ $<
diff --git a/dos/Makefile b/dos/Makefile
index afcb1465..f580e01e 100644
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -59,17 +59,8 @@ libcom.a: $(LIBOBJS)
syslinux.com: syslinux.elf
$(OBJCOPY) -O binary $< $@
-%.o: %.c
- $(CC) $(MAKEDEPS) $(CFLAGS) -c -o $@ $<
-%.i: %.c
- $(CC) $(MAKEDEPS) $(CFLAGS) -E -o $@ $<
-%.s: %.c
- $(CC) $(MAKEDEPS) $(CFLAGS) -S -o $@ $<
-%.o: %.S
- $(CC) $(MAKEDEPS) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
-%.s: %.S
- $(CC) $(MAKEDEPS) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $<
%.com: %.asm
+ ( $(NASM) -DDEPEND $(NASMOPT) -o $@ -M $< && echo '' ) > .$@.d; true
$(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
-include .*.d *.tmp
diff --git a/mbr/Makefile b/mbr/Makefile
index e0695843..3140132a 100644
--- a/mbr/Makefile
+++ b/mbr/Makefile
@@ -23,13 +23,13 @@ all: mbr.bin altmbr.bin gptmbr.bin isohdpfx.bin \
mbr_f.bin altmbr_f.bin gptmbr_f.bin isohdpfx_f.bin
.PRECIOUS: %.o
-%.o: %.S adjust.h
+%.o: %.S
$(CC) $(MAKEDEPS) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<
-%_c.o: %.S adjust.h
+%_c.o: %.S
$(CC) $(MAKEDEPS) $(SFLAGS) -Wa,-a=$*_c.lst -DCTRL_80 -c -o $@ $<
-%_f.o: %.S adjust.h
+%_f.o: %.S
$(CC) $(MAKEDEPS) $(SFLAGS) -Wa,-a=$*_f.lst -DFORCE_80 -c -o $@ $<
.PRECIOUS: %.elf
diff --git a/memdisk/Makefile b/memdisk/Makefile
index 7b557e11..201dffaf 100644
--- a/memdisk/Makefile
+++ b/memdisk/Makefile
@@ -15,10 +15,9 @@ topdir = ..
include $(topdir)/MCONFIG.embedded
-include $(topdir)/version.mk
-CFLAGS = $(GCCOPT) -g -W -Wall -Wno-sign-compare -DDATE='"$(DATE)"'
-SFLAGS = $(GCCOPT) -D__ASSEMBLY__
+INCLUDES = -I$(topdir)/com32/include
+CFLAGS += -DDATE='"$(DATE)"'
LDFLAGS = $(GCCOPT) -g
-INCLUDE = -I$(topdir)/com32/include
NASM = nasm
NASMOPT = -O9999
NFLAGS = -dDATE='"$(DATE)"'
@@ -49,7 +48,7 @@ all: memdisk # e820test
# tidy, clean removes everything except the final binary
tidy dist:
- rm -f *.o *.s *.tmp *.o16 *.s16 *.bin *.lst *.elf e820test
+ rm -f *.o *.s *.tmp *.o16 *.s16 *.bin *.lst *.elf e820test .*.d
clean: tidy
@@ -58,39 +57,17 @@ spotless: clean
rm -f memdisk .depend
memdisk16.o: memdisk16.asm
- $(NASM) $(NASMOPT) $(NFLAGS) $(NINCLUDE) -f elf -l $*.lst -o $@ $<
-%.o: %.s
- $(CC) $(SFLAGS) -c -o $@ $<
+# Cancel rule
+%.o: %.asm
-%.o: %.S
- $(CC) $(INCLUDE) $(SFLAGS) -c -o $@ $<
-
-%.o16: %.s16
- $(CC) $(SFLAGS) -x assembler -c -o $@ $<
-
-%.o: %.c
- $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $<
-
-%.s16: %.s
- echo '.code16gcc' | cat - $< > $@
-
-%.s: %.S
- $(CC) $(INCLUDE) $(SFLAGS) -E -o $@ $<
-
-%.s16: %.S16
- $(CC) $(INCLUDE) $(SFLAGS) -x assembler-with-cpp -E -o $@ $<
-
-%.s: %.c
- $(CC) $(INCLUDE) $(CFLAGS) -S -o $@ $<
-
-%.i: %.c
- $(CC) $(INCLUDE) $(CFLAGS) -E -o $@ $<
-
-# Cancel default rule
-%.o: %.c
+memdisk16.o: memdisk16.asm
+ ( $(NASM) -DDEPEND $(NFLAGS) $(NINCLUDE) -o $@ $< ; echo '' ) >> .$@.d ; true
+ $(NASM) -f elf $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $<
+.PRECIOUS: %.bin
%.bin: %.asm
+ ( $(NASM) -DDEPEND $(NFLAGS) $(NINCLUDE) -o $@ $< ; echo '' ) >> .$@.d ; true
$(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $<
memdisk_%.o: memdisk_%.bin
@@ -111,21 +88,8 @@ memdisk: memdisk16.bin memdisk32.bin postprocess.pl
e820test: e820test.c e820func.c msetup.c
$(CC) -m32 -g -W -Wall -DTEST -o $@ $^
-.depend:
- rm -f .depend
- for csrc in *.c ; do $(CC) $(INCLUDE) $(CFLAGS) -MM $$csrc >> .depend ; done ; true
- for ssrc in *.S ; do $(CC) $(INCLUDE) $(SFLAGS) -MM $$ssrc >> .depend ; done ; true
- for nsrc in $(NASMSRC) ; do \
- ( $(NASM) -DDEPEND $(NINCLUDE) -o \
- `echo $$nsrc | sed -e 's/\.asm/\.bin/'` -M $$nsrc ; \
- echo '' ) >> .depend ; done ; true
-
-depend:
- rm -f .depend
- $(MAKE) .depend
-
# This file contains the version number, so add a dependency for it
setup.s: ../version
# Include dependencies file
--include .depend
+-include .*.d
diff --git a/memdisk/memdisk.inc b/memdisk/memdisk.inc
index 27e9fdb1..fa4fe3e5 100644
--- a/memdisk/memdisk.inc
+++ b/memdisk/memdisk.inc
@@ -17,9 +17,7 @@
;
; ****************************************************************************
-%ifndef DEPEND
-%include "../version.gen"
-%endif
+%include "../version.gen"
; %define DEBUG_TRACERS ; Uncomment to get debugging tracers
diff --git a/memdump/Makefile b/memdump/Makefile
index 6696020c..05f26383 100644
--- a/memdump/Makefile
+++ b/memdump/Makefile
@@ -54,14 +54,14 @@ memdump.com: memdump.elf
$(OBJCOPY) -O binary $< $@
%.o: %.c
- $(CC) -Wp,-MT,$@,-MD,.$@.d $(CFLAGS) -c -o $@ $<
+ $(CC) $(MAKEDEPS) $(CFLAGS) -c -o $@ $<
%.i: %.c
- $(CC) $(CFLAGS) -E -o $@ $<
+ $(CC) $(MAKEDEPS) $(CFLAGS) -E -o $@ $<
%.s: %.c
- $(CC) $(CFLAGS) -S -o $@ $<
+ $(CC) $(MAKEDEPS) $(CFLAGS) -S -o $@ $<
%.o: %.S
- $(CC) -Wp,-MT,$@,-MD,.$@.d $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
+ $(CC) $(MAKEDEPS) $(SFLAGS) -c -o $@ $<
%.s: %.S
- $(CC) $(CFLAGS) -E -o $@ $<
+ $(CC) $(MAKEDEPS) $(SFLAGS) -E -o $@ $<
-include .*.d *.tmp
diff --git a/modules/Makefile b/modules/Makefile
index a3af7b70..3f82eeeb 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -24,12 +24,6 @@ BINS = pxechain.com gfxboot.com
all: $(BINS)
.PRECIOUS: %.o
-%.o: %.S
- $(CC) $(SFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.o
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
.PRECIOUS: %.elf
%.elf: c32entry.o %.o $(LIB)
@@ -39,6 +33,7 @@ all: $(BINS)
$(OBJCOPY) -O binary $< $@
%.com: %.asm
+ ( $(NASM) -DDEPEND -o $@ $< ; echo '' ) >> .$@.d ; true
$(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
$(LIB): $(LIBOBJS)
@@ -55,9 +50,11 @@ $(LIB): $(LIBOBJS)
$(PNGTOPNM) $< | gzip -9 > $@
tidy dist:
- rm -f *.o *.a *.lst *.elf
+ rm -f *.o *.a *.lst *.elf .*.d
clean: tidy
spotless: clean
rm -f $(BINS)
+
+-include .*.d
diff --git a/sample/Makefile b/sample/Makefile
index e4c4a6d6..e6bf5def 100644
--- a/sample/Makefile
+++ b/sample/Makefile
@@ -33,12 +33,6 @@ all: syslogo.lss comecho.com hello.c32 hello2.c32 filetest.c32 c32echo.c32 \
fd.c32 $(LIB)
.PRECIOUS: %.o
-%.o: %.S
- $(CC) $(SFLAGS) -c -o $@ $<
-
-.PRECIOUS: %.o
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
.PRECIOUS: %.elf
%.elf: c32entry.o %.o $(LIB)
@@ -48,6 +42,7 @@ all: syslogo.lss comecho.com hello.c32 hello2.c32 filetest.c32 c32echo.c32 \
$(OBJCOPY) -O binary $< $@
%.com: %.asm
+ ( $(NASM) -DDEPEND -o $@ $< ; echo '' ) >> .$@.d ; true
$(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
$(LIB): $(LIBOBJS)
@@ -64,10 +59,12 @@ $(LIB): $(LIBOBJS)
$(PNGTOPNM) $< | gzip -9 > $@
tidy dist:
- rm -f *.o *.a *.lst *.elf
+ rm -f *.o *.a *.lst *.elf .*.d
# Don't specify *.com since mdiskchk.com can't be built using Linux tools
clean: tidy
rm -f *.lss *.o *.c32 comecho.com
spotless: clean
+
+-include .*.d