build: fix various target inter-dependencies

This commit is contained in:
Philippe Gerum 2019-06-08 19:41:45 +02:00
parent ef5dec6119
commit 1611835618
7 changed files with 26 additions and 25 deletions

View File

@ -11,4 +11,4 @@ $(MAIN_GOALS): output-Makefile
lib: include
tests utils: lib
tests utils commands: lib

View File

@ -13,9 +13,9 @@ CMD_CPPFLAGS := $(BASE_CPPFLAGS) -I. -I$(O_DIR)/../include
CMD_CFLAGS := $(CMD_CPPFLAGS) $(BASE_CFLAGS)
override CFLAGS := $(CMD_CFLAGS) $(CFLAGS)
$(TARGETS): output-Makefile
$(TARGETS):
all: $(TARGETS)
all: output-Makefile $(TARGETS)
install: all
$(call inst-cmd,commands, \
@ -29,7 +29,7 @@ install: all
name=evl-$$hlp; \
$(INSTALL) -D $(O_DIR)/$$hlp $(DESTDIR)/$(libexecdir)/$$name; done)
clean clobber mrproper:
clean clobber mrproper: output-Makefile
$(Q)$(RM) -f $(TARGETS) $(DEPFILES)
$(O_DIR)/%: %.c

View File

@ -121,4 +121,6 @@ ifneq ($(O_DIR), $(CURDIR))
fi
endif
.PHONY: _all $(MAIN_GOALS) $(TARGETS) output-Makefile
FORCE:
.PHONY: _all $(MAIN_GOALS) output-Makefile FORCE

View File

@ -6,26 +6,26 @@ O_UAPI = $(O_DIR)/uapi
TARGETS := uapi
$(TARGETS): output-Makefile
uapi: $(O_UAPI)
uapi: $(O_DIR)/.uapi_stamp $(O_UAPI)
$(O_DIR)/.uapi_stamp $(O_DIR)/uapi:
$(O_UAPI): $(O_DIR)/.uapi_stamp
$(Q)$(MKDIR_P) $(O_UAPI)
$(Q)$(RM) -f $(O_UAPI)/asm $(O_UAPI)/evl
$(Q)if test -r $(UAPI)/Makefile; then \
$(Q)if test -r $(UAPI)/Kbuild; then \
$(LN_S) $(UAPI)/arch/$(ARCH)/include/uapi/asm $(O_UAPI)/asm; \
$(LN_S) $(UAPI)/include/uapi/evl $(O_UAPI)/evl; \
else \
elif test \! -L $(O_UAPI)/asm; then \
$(LN_S) $(UAPI)/asm $(O_UAPI)/asm; \
$(LN_S) $(UAPI)/evl $(O_UAPI)/evl; \
fi; \
touch $@
fi
all: uapi
$(O_DIR)/.uapi_stamp: FORCE
@touch $@
# Remove the UAPI links. Careful with removing $(O_DIR)/uapi, just in case.
clean clobber mrproper:
all: output-Makefile $(TARGETS)
# Remove the UAPI links. Careful with removing $(O_UAPI), just in case.
clean clobber mrproper: output-Makefile
$(Q)$(RM) -f $(O_DIR)/.uapi_stamp $(O_UAPI)/asm $(O_UAPI)/evl
$(Q)test -d $(O_UAPI) && $(RMDIR_SAFE) $(O_UAPI) || :

View File

@ -26,9 +26,7 @@ override CFLAGS := $(LIB_CFLAGS) $(CFLAGS)
override LDFLAGS := $(LDFLAGS) -lpthread -lrt
$(TARGETS): output-Makefile
all: $(TARGETS)
all: output-Makefile $(TARGETS)
install: all
$(call inst-cmd,$(SOLIBNAME),$(INSTALL) -D $(O_DIR)/$(SOLIBNAME) $(DESTDIR)/$(libdir)/$(SOLIBNAME))

View File

@ -7,7 +7,9 @@ ALLSRC := $(wildcard *.c)
HELPSRC := helpers.c
HELPOBJ := $(O_DIR)/helpers.o
TESTSRC := $(filter-out $(HELPSRC),$(ALLSRC))
FPSRC := fault.c
TARGETS = $(TESTSRC:%.c=$(O_DIR)/%)
NEEDLIBM = $(FPSRC:%.c=$(O_DIR)/%)
DEPFILES = $(ALLSRC:%.c=$(O_DIR)/%.d)
TEST_CPPFLAGS := $(BASE_CPPFLAGS) \
@ -20,10 +22,11 @@ override CFLAGS := $(TEST_CFLAGS) $(CFLAGS)
TEST_LDFLAGS := $(O_DIR)/../lib/libevl.so.$(EVL_IVERSION) -lpthread -lrt
override LDFLAGS := $(TEST_LDFLAGS) $(LDFLAGS)
$(NEEDLIBM): override LDFLAGS += -lm
all: $(TARGETS)
all: output-Makefile $(TARGETS)
$(TARGETS): output-Makefile $(HELPOBJ)
$(TARGETS): $(HELPOBJ)
install: all
$(Q)for bin in $(TESTSRC:%.c=%); do \

View File

@ -19,16 +19,14 @@ override CFLAGS := $(UTIL_CFLAGS) $(CFLAGS)
UTIL_LDFLAGS := $(O_DIR)/../lib/libevl.so.$(EVL_IVERSION) -lpthread -lrt
override LDFLAGS := $(UTIL_LDFLAGS) $(LDFLAGS)
$(TARGETS): output-Makefile
all: $(TARGETS)
all: output-Makefile $(TARGETS)
install: all
$(Q)for bin in $(BINARIES); do \
$(INSTALL) -D $(O_DIR)/$$bin $(DESTDIR)/$(bindir)/$$bin; \
done
clean clobber mrproper:
clean clobber mrproper: output-Makefile
$(Q)$(RM) -f $(TARGETS) $(DEPFILES)
$(O_DIR)/%: %.c