[PATCH] 头文件自动依赖

发布于 2022-09-18 03:13:21 字数 30148 浏览 10 评论 0

如果头文件改变,则remake的话,相关的c文件会自动重新编译。

signed-off-by: linke wang <linke.wang@gmail.com>

Index: g-bios/device/graphics/Makefile
===================================================================
--- g-bios/device/graphics/Makefile        (revision 48
+++ g-bios/device/graphics/Makefile        (working copy)
@@ -4,14 +4,15 @@
OBJS_C = $(obj-y)
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/device/watchdog/Makefile
===================================================================
--- g-bios/device/watchdog/Makefile        (revision 48
+++ g-bios/device/watchdog/Makefile        (working copy)
@@ -1,17 +1,17 @@

-OBJS = s3c2410_wh.o
+OBJS_C = s3c2410_wh.o

-all : built-in.o
+all: .depend $(BUILT_IN_OBJ)

+$(BUILT_IN_OBJ): $(OBJS_C)
+        $(LD) $(LDFLAGS) -r $^ -o $@

-built-in.o : $(OBJS)
-        $(LD) $(LDFLAGS) -r $^ -o $@
+include $(TOP_DIR)/config.mk

-$(OBJS) :
-        $(CC) $(CFLAGS) -c $(@:.o=.c)
+sinclude .depend

.PHONY : $(OBJS)

clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend
Index: g-bios/device/timer/Makefile
===================================================================
--- g-bios/device/timer/Makefile        (revision 48
+++ g-bios/device/timer/Makefile        (working copy)
@@ -9,14 +9,15 @@
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/device/led/Makefile
===================================================================
--- g-bios/device/led/Makefile        (revision 48
+++ g-bios/device/led/Makefile        (working copy)
@@ -5,14 +5,15 @@
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/device/net/Makefile
===================================================================
--- g-bios/device/net/Makefile        (revision 48
+++ g-bios/device/net/Makefile        (working copy)
@@ -6,14 +6,15 @@
OBJS_C = tftp.o net_core.o socket.o $(obj-y)
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/device/rtc/Makefile
===================================================================
--- g-bios/device/rtc/Makefile        (revision 48
+++ g-bios/device/rtc/Makefile        (working copy)
@@ -9,14 +9,15 @@
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/device/key/Makefile
===================================================================
--- g-bios/device/key/Makefile        (revision 48
+++ g-bios/device/key/Makefile        (working copy)
@@ -8,14 +8,15 @@
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/device/uart/Makefile
===================================================================
--- g-bios/device/uart/Makefile        (revision 48
+++ g-bios/device/uart/Makefile        (working copy)
@@ -8,14 +8,15 @@
OBJS_C = $(obj-y)
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/device/interrupt/Makefile
===================================================================
--- g-bios/device/interrupt/Makefile        (revision 48
+++ g-bios/device/interrupt/Makefile        (working copy)
@@ -9,14 +9,15 @@
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/device/flash/Makefile
===================================================================
--- g-bios/device/flash/Makefile        (revision 48
+++ g-bios/device/flash/Makefile        (working copy)
@@ -9,14 +9,15 @@
OBJS_C += $(obj-y)
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: .depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/app/serial/Makefile
===================================================================
--- g-bios/app/serial/Makefile        (revision 488)
+++ g-bios/app/serial/Makefile        (working copy)
@@ -1,20 +1,21 @@

-OBJS = kermit_util.o
+OBJS_C = kermit_util.o

-SRCS = $(OBJS:.o=.c)
+SRCS_C = $(OBJS_C:.o=.c)

PHONY += all
-all : $(BUILT_IN_OBJ)
+all : depend $(BUILT_IN_OBJ)

-$(BUILT_IN_OBJ) : $(OBJS)
+$(BUILT_IN_OBJ) : $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS) : $(SRCS)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
PHONY += clean
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY : $(PHONY)

Index: g-bios/app/boot/Makefile
===================================================================
--- g-bios/app/boot/Makefile        (revision 488)
+++ g-bios/app/boot/Makefile        (working copy)
@@ -1,19 +1,20 @@
-OBJS = boot_linux.o
+OBJS_C = boot_linux.o

-SRCS = $(OBJS:.o=.c)
+SRCS_C = $(OBJS_C:.o=.c)

PHONY += all
-all : $(BUILT_IN_OBJ)
+all : depend $(BUILT_IN_OBJ)

-$(BUILT_IN_OBJ) : $(OBJS)
+$(BUILT_IN_OBJ) : $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS) : $(SRCS)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
PHONY += clean
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY : $(PHONY)

Index: g-bios/app/net/Makefile
===================================================================
--- g-bios/app/net/Makefile        (revision 488)
+++ g-bios/app/net/Makefile        (working copy)
@@ -1,19 +1,20 @@

-OBJS = ifconfig.o tftp_util.o ping.o
-SRCS = $(OBJS:.o=.c)
+OBJS_C = ifconfig.o tftp_util.o ping.o
+SRCS_C = $(OBJS_C:.o=.c)

PHONY += all
-all : $(BUILT_IN_OBJ)
+all : depend $(BUILT_IN_OBJ)

-$(BUILT_IN_OBJ) : $(OBJS)
+$(BUILT_IN_OBJ) : $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS) : $(SRCS)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
PHONY += clean
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY : $(PHONY)

Index: g-bios/app/shell/Makefile
===================================================================
--- g-bios/app/shell/Makefile        (revision 488)
+++ g-bios/app/shell/Makefile        (working copy)
@@ -1,19 +1,20 @@
-OBJS = shell.o cd.o
+OBJS_C = shell.o cd.o

-SRCS = $(OBJS:.o=.c)
+SRCS_C = $(OBJS_C:.o=.c)

PHONY += all
-all : $(BUILT_IN_OBJ)
+all : depend $(BUILT_IN_OBJ)

-$(BUILT_IN_OBJ) : $(OBJS)
+$(BUILT_IN_OBJ) : $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS) : $(SRCS)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
PHONY += clean
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY : $(PHONY)

Index: g-bios/app/memory/Makefile
===================================================================
--- g-bios/app/memory/Makefile        (revision 488)
+++ g-bios/app/memory/Makefile        (working copy)
@@ -1,19 +1,20 @@
OBJS = mem_op.o

-SRCS = $(OBJS:.o=.c)
+SRCS_C = $(OBJS_C:.o=.c)

PHONY += all
-all : $(BUILT_IN_OBJ)
+all : .depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ) : $(OBJS)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS) : $(SRCS)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
PHONY += clean
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY : $(PHONY)

Index: g-bios/app/flash/Makefile
===================================================================
--- g-bios/app/flash/Makefile        (revision 488)
+++ g-bios/app/flash/Makefile        (working copy)
@@ -1,20 +1,21 @@

-OBJS = part_show.o part_erase.o flash_erase.o flash_dump.o sysconf.o
+OBJS_C = part_show.o part_erase.o flash_erase.o flash_dump.o sysconf.o

-SRCS = $(OBJS:.o=.c)
+SRCS_C = $(OBJS_C:.o=.c)

PHONY += all
-all : $(BUILT_IN_OBJ)
+all : .depend $(BUILT_IN_OBJ)

-$(BUILT_IN_OBJ) : $(OBJS)
+$(BUILT_IN_OBJ) : $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS) : $(SRCS)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
PHONY += clean
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY : $(PHONY)

Index: g-bios/app/sys/Makefile
===================================================================
--- g-bios/app/sys/Makefile        (revision 488)
+++ g-bios/app/sys/Makefile        (working copy)
@@ -1,19 +1,20 @@
-OBJS = sys_cmd.o
+OBJS_C = sys_cmd.o

-SRCS = $(OBJS:.o=.c)
+SRCS_C = $(OBJS_C:.o=.c)

PHONY += all
all : $(BUILT_IN_OBJ)

-$(BUILT_IN_OBJ) : $(OBJS)
+$(BUILT_IN_OBJ) : $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS) : $(SRCS)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
PHONY += clean
clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY : $(PHONY)

Index: g-bios/boot/arm/atmel/Makefile
===================================================================
--- g-bios/boot/arm/atmel/Makefile        (revision 488)
+++ g-bios/boot/arm/atmel/Makefile        (working copy)
@@ -5,17 +5,15 @@
OBJS_C = pio_at91sam926x.o
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C) $(OBJS_ASM)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

-$(OBJS_ASM): $(SRCS_ASM)
-        $(CC) $(ASFLAGS) -c $<
+sinclude .depend

clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/boot/arm/samsung/Makefile
===================================================================
--- g-bios/boot/arm/samsung/Makefile        (revision 488)
+++ g-bios/boot/arm/samsung/Makefile        (working copy)
@@ -7,17 +7,15 @@
OBJS_C = s3c24xx.o uart_s3c24xx.o $(objs-y)
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C) $(OBJS_ASM)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(SRCS_C)
+include $(TOP_DIR)/config.mk

-$(OBJS_ASM): $(SRCS_ASM)
-        $(CC) $(ASFLAGS) -c $<
+sinclude .depend

clean :
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/boot/arm/Makefile
===================================================================
--- g-bios/boot/arm/Makefile        (revision 488)
+++ g-bios/boot/arm/Makefile        (working copy)
@@ -8,7 +8,7 @@
SUBDIRS = $(SOC_VENDOR)
SUB_BUILT_IN_OBJS := $(foreach n, $(SUBDIRS), $(n)/$(BUILT_IN_OBJ))

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_S) $(SUB_BUILT_IN_OBJS) $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $(BUILT_IN_OBJ)
@@ -18,17 +18,15 @@
$(SUBDIRS):
        @make -C $@ all

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

-$(OBJS_S): $(SRCS_S)
-        $(CC) $(ASFLAGS) -c $^
+sinclude .depend

clean:
        @for dir in $(SUBDIRS); do \
                make -C $$dir clean; \
         done       
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY: $(SUBDIRS)

Index: g-bios/boot/Makefile
===================================================================
--- g-bios/boot/Makefile        (revision 488)
+++ g-bios/boot/Makefile        (working copy)
@@ -7,11 +7,8 @@
SUBDIRS = $(ARCH)
SUB_BUILT_IN_OBJS := $(foreach n, $(SUBDIRS), $(n)/$(BUILT_IN_OBJ))

-all: g-bios-th.bin g-bios-th.dis $(IMAGE_OUT_DIR)/g-bios-th.bin
+all: depend g-bios-th.bin g-bios-th.dis $(IMAGE_OUT_DIR)/g-bios-th.bin

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $^
-
$(SUB_BUILT_IN_OBJS): $(SUBDIRS)

$(SUBDIRS):
@@ -33,10 +30,14 @@
kermit.c:
        @ln -sf $(TOP_DIR)/lib/$@ $@

+include $(TOP_DIR)/config.mk
+
+sinclude .depend
+
clean:
        @for dir in $(SUBDIRS); do \
                make -C $$dir clean; \
         done       
-        @rm -vf *.o g-bios-th.*
+        @rm -vf *.o g-bios-th.* .depend

.PHONY: $(SUBDIRS)
Index: g-bios/lib/arm/Makefile
===================================================================
--- g-bios/lib/arm/Makefile        (revision 488)
+++ g-bios/lib/arm/Makefile        (working copy)
@@ -5,16 +5,14 @@
OBJS_C = div0.o backtrace.o
SRCS_C := $(OBJS_C:.o=.c)

-all : $(BUILT_IN_OBJ)
+all : depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_ASM) $(OBJS_C)
        $(LD) -r $(LDFLAGS) -o $@ $^

-$(OBJS_ASM): $(SRCS_ASM)
-        $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $(@:.o=.S)
+include $(TOP_DIR)/config.mk

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(@:.o=.c)
+sinclude .depend

clean:
-        @rm -vf *.o
+        @rm -vf *.o .depend
Index: g-bios/lib/stdlib/Makefile
===================================================================
--- g-bios/lib/stdlib/Makefile        (revision 488)
+++ g-bios/lib/stdlib/Makefile        (working copy)
@@ -2,15 +2,16 @@
OBJS_C = stdio.o string.o stdlib.o getopt.o misc.o
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) -r $(LDFLAGS) -o $@ $^

-$(OBJS_C)(SRCS_C)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean:
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/lib/Makefile
===================================================================
--- g-bios/lib/Makefile        (revision 488)
+++ g-bios/lib/Makefile        (working copy)
@@ -6,7 +6,7 @@

SUB_BUILT_IN_OBJS := $(foreach n, $(SUBDIRS), $(n)/$(BUILT_IN_OBJ))

-all: $(SUBDIRS) $(BUILT_IN_OBJ)
+all: depend $(SUBDIRS) $(BUILT_IN_OBJ)

$(SUBDIRS):
        @make -C $@ all
@@ -14,14 +14,15 @@
$(BUILT_IN_OBJ): $(SUB_BUILT_IN_OBJS) $(OBJS_C)
        $(LD) $(LDFLAGS) -r $^ -o $@

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean:
        @for dir in $(SUBDIRS); do \
                make -C $$dir clean; \
         done       
-        @rm -vf *.o
+        @rm -vf *.o .depend

.PHONY: $(SUBDIRS)

Index: g-bios/thread/Makefile
===================================================================
--- g-bios/thread/Makefile        (revision 488)
+++ g-bios/thread/Makefile        (working copy)
@@ -3,13 +3,14 @@
OBJS_C = main.o
SRCS_C := $(OBJS_C:.o=.c)

-all : $(BUILT_IN_OBJ)
+all : depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ) : $(OBJS_C)
        $(LD) -r $(LDFLAGS) -o $@ $^

-$(OBJS_C)(SRCS_C)
-        $(CC) $(CFLAGS) -c $(@:.o=.c)
-       
+include $(TOP_DIR)/config.mk
+
+sinclude .depend
+
clean:
-        @rm -vf *.o
+        @rm -vf *.o .depend
Index: g-bios/mm/heap/Makefile
===================================================================
--- g-bios/mm/heap/Makefile        (revision 488)
+++ g-bios/mm/heap/Makefile        (working copy)
@@ -2,14 +2,15 @@
OBJS_C =  malloc.o
SRCS_C := $(OBJS_C:.o=.c)

-all: $(BUILT_IN_OBJ)
+all: depend $(BUILT_IN_OBJ)

$(BUILT_IN_OBJ): $(OBJS_C)
        $(LD) -r $(LDFLAGS) -o $@ $^

-$(OBJS_C)(SRCS_C)
-        $(CC) $(CFLAGS) -c $^
+include $(TOP_DIR)/config.mk

+sinclude .depend
+
clean:
-        @rm -vf *.o
+        @rm -vf *.o .depend

Index: g-bios/config.mk
===================================================================
--- g-bios/config.mk        (revision 0)
+++ g-bios/config.mk        (revision 0)
@@ -0,0 +1,20 @@
+
+
+depend: .depend
+
+.depend: $(SRCS_C) $(SRCS_ASM)
+        @rm -rf $@
+        @for single in $(wildcard *.c); do \
+                base=`basename $$single | sed -e 's/\(.*\)\.\w/\1.o/'`; \
+                        $(CC) -M $(CFLAGS) -MQ $$base $$single >> $@; \
+        done
+        @for single in $(wildcard *.S); do \
+                base=`basename $$single | sed -e 's/\(.*\)\.\w/\1.o/'`; \
+                        $(CC) -M $(ASFLAGS) -MQ $$base $$single >> $@; \
+        done
+
+%.o: %.c
+        $(CC) $(CFLAGS) -c $< -o $@
+
+%.o: %.S
+        $(CC) $(ASFLAGS) -c $< -o $@
Index: g-bios/arch/arm/atmel/Makefile
===================================================================
--- g-bios/arch/arm/atmel/Makefile        (revision 488)
+++ g-bios/arch/arm/atmel/Makefile        (working copy)
@@ -13,7 +13,7 @@

SUB_BUILT_IN_OBJS := $(foreach n, $(SUBDIRS), $(n)/$(BUILT_IN_OBJ))

-all : $(SUBDIRS) $(BUILT_IN_OBJ)
+all : depend $(SUBDIRS) $(BUILT_IN_OBJ)

$(SUBDIRS):
        @make -C $@ all
@@ -21,11 +21,9 @@
$(BUILT_IN_OBJ): $(SUB_BUILT_IN_OBJS) $(OBJS_ASM) $(OBJS_C)
        $(LD) -r $(LDFLAGS) -o $@ $^

-$(OBJS_ASM): $(SRCS_ASM)
-        $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $(@:.o=.S)
+include $(TOP_DIR)/config.mk

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(@:.o=.c)
+sinclude .depend

clean:
-        @rm -vf *.o
+        @rm -vf *.o .depend
Index: g-bios/arch/arm/samsung/Makefile
===================================================================
--- g-bios/arch/arm/samsung/Makefile        (revision 488)
+++ g-bios/arch/arm/samsung/Makefile        (working copy)
@@ -12,7 +12,7 @@

SUB_BUILT_IN_OBJS := $(foreach n, $(SUBDIRS), $(n)/$(BUILT_IN_OBJ))

-all : $(SUBDIRS) $(BUILT_IN_OBJ)
+all : depend $(SUBDIRS) $(BUILT_IN_OBJ)

$(SUBDIRS):
        @make -C $@ all
@@ -20,11 +20,9 @@
$(BUILT_IN_OBJ): $(SUB_BUILT_IN_OBJS) $(OBJS_ASM) $(OBJS_C)
        $(LD) -r $(LDFLAGS) -o $@ $^

-$(OBJS_ASM): $(SRCS_ASM)
-        $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $(@:.o=.S)
+include $(TOP_DIR)/config.mk

-$(OBJS_C): $(SRCS_C)
-        $(CC) $(CFLAGS) -c $(@:.o=.c)
+sinclude .depend

clean:
-        @rm -vf *.o
+        @rm -vf *.o .depend

......省略了。一版放不下。详情请见附件。

[ 本帖最后由 goldenhope 于 2009-9-12 11:36 编辑 ]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

跨年 2022-09-25 03:13:21

great! 终于有人完成这项功能了!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文