depend.mk, rules.mk: Move dependency rules from rules.mk to depend.mk

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-11-23 08:41:06 +00:00
commit e37efb1a5e
2 changed files with 18 additions and 22 deletions

View file

@ -4,8 +4,16 @@ DEPEND_CPPFLAGS += -D__MAKEDEPEND__
DEPEND_MK += $(addprefix .,$(addsuffix .dep.mk, $(OBJ))) DEPEND_MK += $(addprefix .,$(addsuffix .dep.mk, $(OBJ)))
ifeq ($(DEPEND_MK_INCLUDED),) ifeq ($(DEPEND_MK_INCLUDED),)
# mandatory target behaviour
all: all:
clean: depclean
# convenience targets
dep: $(DEPEND_MK)
depclean:
$(RM) -f .*.dep.mk
$(DEPEND_MK): $(PREREQ_DONE)
ifneq ($(DEPEND_MK),) ifneq ($(DEPEND_MK),)
ifeq ($(MAKECMDGOALS),) ifeq ($(MAKECMDGOALS),)
@ -16,16 +24,16 @@ ifneq ($(DEPEND_MK),)
endif endif
endif endif
clean: depclean my_depclean
# convenience targets
dep: $(DEPEND_MK)
my_depclean:
$(RM) -f .*.dep.mk
# rules
$(DEPEND_MK): $(PREREQ_DONE)
%.o: .%.o.dep.mk %.o: .%.o.dep.mk
.%.o.dep.mk: %.cpp $(BUILD_HDR)
$(CC) -M $(BUILD_CPPFLAGS) $(DEPEND_CPPFLAGS) $< -o $@
.%.o.dep.mk: %.cc $(BUILD_HDR)
$(CC) -M $(BUILD_CPPFLAGS) $(DEPEND_CPPFLAGS) $< -o $@
.%.o.dep.mk: %.c $(BUILD_HDR)
$(CC) -M $(BUILD_CFLAGS) $(DEPEND_CPPFLAGS) $< -o $@
endif # DEPEND_MK_INCLUDED endif # DEPEND_MK_INCLUDED
DEPEND_MK_INCLUDED := true DEPEND_MK_INCLUDED := true

View file

@ -81,9 +81,6 @@ runclean: coreclean
objclean: objclean:
$(RM) -rf *.o *.o *.a *.so *.so.* $(RM) -rf *.o *.o *.a *.so *.so.*
depclean:
$(RM) -f .*.dep.mk
mocclean: mocclean:
$(RM) -rf moc_* $(RM) -rf moc_*
@ -251,15 +248,6 @@ strip.done: $(EXE_ALL)
$(STRIP) $^ $(STRIP) $^
touch $@ touch $@
.%.o.dep.mk: %.cpp $(BUILD_HDR)
$(CC) -M $(BUILD_CPPFLAGS) $(DEPEND_CPPFLAGS) $< -o $@
.%.o.dep.mk: %.cc $(BUILD_HDR)
$(CC) -M $(BUILD_CPPFLAGS) $(DEPEND_CPPFLAGS) $< -o $@
.%.o.dep.mk: %.c $(BUILD_HDR)
$(CC) -M $(BUILD_CFLAGS) $(DEPEND_CPPFLAGS) $< -o $@
ifeq ($(LIBTYPE),shared) ifeq ($(LIBTYPE),shared)
$(SO_PREFIX)%.so: %.o $(SO_PREFIX)%.so: %.o
$(LD) -shared $(BUILD_LDFLAGS) $(FLAVOUR_PREFIX)$^ -o $@ $(LD) -shared $(BUILD_LDFLAGS) $(FLAVOUR_PREFIX)$^ -o $@