summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-31 16:49:52 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-31 16:49:52 +0000
commit8040ad5d521628ba9a5177b25e142f4a0ed3dd5b (patch)
tree417bc33f55606e7b5bb5face2392325889f1e3c1
parent49d47f2b7ebee52827b42b9325b66a4abd36b226 (diff)
- generate deps via gcc
-rw-r--r--Makerules19
-rw-r--r--libc/inet/Makefile.in9
2 files changed, 16 insertions, 12 deletions
diff --git a/Makerules b/Makerules
index f9e21f1be..6e5dfed94 100644
--- a/Makerules
+++ b/Makerules
@@ -99,8 +99,10 @@ disp_t_strip = $($(DISP)_disp_t_strip)
disp_ar = $($(DISP)_disp_ar)
disp_ld = $($(DISP)_disp_ld)
-cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(^D)))) $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) $(CFLAGS-$(notdir $<)) $(CFLAGS-$(notdir $@))
-cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@))
+cmd_gen.dep = -MT $@ -MD -MF $(@D)/$(@F).dep
+
+cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(filter-out $(CFLAGS-OMIT-$(notdir $<)),$(CFLAGS-$(notdir $(^D)))) $(CFLAGS-$(subst $(top_srcdir),,$(dir $<))) $(CFLAGS-$(notdir $<)) $(CFLAGS-$(notdir $@)) $(cmd_gen.dep)
+cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(cmd_gen.dep)
cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@))
@@ -292,13 +294,24 @@ $(top_builddir)lib/libpthread_nonshared.a: $(libpthread-nonshared-y)
$(do_strip)
$(do_ar)
+.depends.dep := \
+ $(patsubst %.o,%.o.dep,$(filter %.o,$(libc-a-y) $(libc-so-y))) \
+ $(patsubst %.os,%.os.dep,$(filter %.os,$(libc-a-y) $(libc-so-y))) \
+ $(patsubst %.oS,%.oS.dep,$(filter %.oS,$(libc-a-y) $(libc-so-y)))
+
+ifdef .depends.dep
+-include $(.depends.dep)
+endif
+
.PHONY: dummy create
clean: objclean-y headers_clean-y
+realclean: clean
+ $(Q)$(RM) $(.depends.dep)
objclean-y: $(objclean-y)
headers_clean-y: $(headers_clean-y)
.PHONY: \
- all check clean distclean test \
+ all check clean realclean distclean test \
config dist menuconfig oldconfig release \
subdirs utils
diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in
index 658e21d95..f3f65f4e7 100644
--- a/libc/inet/Makefile.in
+++ b/libc/inet/Makefile.in
@@ -17,9 +17,6 @@ CSRC := getservice.c getproto.c hostid.c getnetent.c getnetbynm.c getnetbyad.c \
# multi source addr.c
addr_CSRC := inet_aton.c inet_addr.c inet_ntoa.c inet_makeaddr.c \
inet_lnaof.c inet_netof.c
-$(patsubst %.c,$(INET_DIR)/%.o,$(addr_CSRC)): $(INET_DIR)/addr.c
-$(patsubst %.c,$(INET_DIR)/%.os,$(addr_CSRC)): $(INET_DIR)/addr.c
-$(patsubst %.c,$(INET_DIR)/%.oS,$(addr_CSRC)): $(INET_DIR)/addr.c
CSRC += $(addr_CSRC)
# multi source resolv.c
@@ -31,9 +28,6 @@ resolv_CSRC += encodeh.c decodeh.c encoded.c decoded.c lengthd.c encodeq.c \
get_hosts_byaddr_r.c gethostbyname2.c getnameinfo.c gethostent.c \
gethostbyname_r.c gethostbyname2_r.c gethostbyaddr_r.c \
res_comp.c ns_name.c ethers.c
-$(patsubst %.c,$(INET_DIR)/%.o,$(resolv_CSRC)): $(INET_DIR)/resolv.c
-$(patsubst %.c,$(INET_DIR)/%.os,$(resolv_CSRC)): $(INET_DIR)/resolv.c
-$(patsubst %.c,$(INET_DIR)/%.oS,$(resolv_CSRC)): $(INET_DIR)/resolv.c
CSRC += $(resolv_CSRC)
# unused ATM
@@ -43,9 +37,6 @@ CSRC += encodep.c decodep.c formquery.c
socketcalls_CSRC += accept.c bind.c connect.c getpeername.c getsockname.c \
getsockopt.c listen.c recv.c recvfrom.c recvmsg.c send.c sendmsg.c \
sendto.c setsockopt.c shutdown.c socket.c socketpair.c
-$(patsubst %.c,$(INET_DIR)/%.o,$(socketcalls_CSRC)): $(INET_DIR)/socketcalls.c
-$(patsubst %.c,$(INET_DIR)/%.os,$(socketcalls_CSRC)): $(INET_DIR)/socketcalls.c
-$(patsubst %.c,$(INET_DIR)/%.oS,$(socketcalls_CSRC)): $(INET_DIR)/socketcalls.c
CSRC += $(socketcalls_CSRC)
INET_SRC := $(patsubst %.c,$(INET_DIR)/%.c,$(CSRC))