Skip to content

Commit

Permalink
Makefile clean up: don't hardcode test target
Browse files Browse the repository at this point in the history
  • Loading branch information
leonmavr committed Sep 27, 2024
1 parent 153c21f commit 37b5329
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TEST_SRC = $(wildcard $(TEST_DIR)/*.c)
ifeq ($(MAKECMDGOALS), test)
# If `test` is passed as a cmd argument, extend flags to handle unit tests
TARGET_SRC = $(TEST_SRC)
TARGETS = $(patsubst $(TEST_DIR)/%.c,%,$(TEST_SRC))
TARGETS = $(patsubst $(TEST_DIR)/%.c, %, $(TEST_SRC))
TARGET_DIR = test
else
TARGET_SRC = $(wildcard $(TARGET_DIR)/*.c)
Expand All @@ -30,7 +30,6 @@ $(TARGETS): %: $(TARGET_DIR)/%.o $(wildcard $(SRC_DIR)/*.o)
$(CC) $(CFLAGS) -c $< -o $@

.PHONY: clean

RM = rm -rf
clean:
$(RM) $(TARGETS) $(SRC_DIR)/*.o $(TARGET_DIR)/*.o tests
$(RM) $(TARGETS) $(SRC_DIR)/*.o $(TARGET_DIR)/*.o $(basename $(notdir $(TEST_SRC)))

0 comments on commit 37b5329

Please sign in to comment.