unix/fiss

makefile: link and compile executable splitted (70471f1780f4ff9ec7605a357d134030a1879cbb)
Repositories | LICENSE

commit 70471f1780f4ff9ec7605a357d134030a1879cbb
parent 8866500a996e7d099e60df1e3a502441e06f98ba
Author: Friedel Schön <[email protected]>
Date:   Fri, 30 Jun 2023 01:37:26 +0200

makefile: link and compile executable splitted

Diffstat:
Mmk/target.mk11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mk/target.mk b/mk/target.mk @@ -14,10 +14,15 @@ $(TARGET_OBJECT_DIR)/%.o: $(SRC_DIR)/%.c $(INCLUDE_FILES) | $(TARGET_OBJECT_DIR) @echo "[ CC ] $@" $(SILENT)$(CC) -o $@ $< -c $(CFLAGS) $(shell mk/extract-flags.sh $< $(TARGET_OBJECT_DIR)) +# Object rules +$(TARGET_OBJECT_DIR)/%.o: $(BIN_DIR)/%.c $(INCLUDE_FILES) | $(TARGET_OBJECT_DIR) + @echo "[ CC ] $@" + $(SILENT)$(CC) -o $@ $< -c $(CFLAGS) $(shell mk/extract-flags.sh $<) + # Executables -$(TARGET_BIN_DIR)/%: $(BIN_DIR)/%.c $(OBJ_FILES) | $(TARGET_BIN_DIR) - @echo "[CCLD] $@" - $(SILENT)$(CC) -o $@ $< $(CFLAGS) $(shell mk/extract-flags.sh $< $(TARGET_OBJECT_DIR)) $(LDFLAGS) +$(TARGET_BIN_DIR)/%: $(TARGET_OBJECT_DIR)/%.o $(OBJ_FILES) | $(TARGET_BIN_DIR) + @echo "[ LD ] $@" + $(SILENT)$(CC) -o $@ $< $(shell mk/extract-flags.sh $(patsubst $(TARGET_BIN_DIR)/%,$(BIN_DIR)/%.c,$@) $(TARGET_OBJECT_DIR)) $(LDFLAGS) $(TARGET_BIN_DIR)/%: $(BIN_DIR)/%.sh | $(TARGET_BIN_DIR) @echo "[COPY] $@"