From f00ba327d957ee1bda11d0fbbcf58c86e5ad9d5f Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 5 Sep 2020 14:12:56 -0700 Subject: [PATCH] Clean up "make clean" targets Remove "Makefile" targets, as they don't do what Eric wanted --- testing/Makefile | 32 ++++++++++++++++++++------------ testing/TODO.txt | 8 +++++--- testing/common/Makefile | 2 +- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/testing/Makefile b/testing/Makefile index a7276e52..65fd8294 100644 --- a/testing/Makefile +++ b/testing/Makefile @@ -1,26 +1,34 @@ COMMON_LIB_DIR?=${PWD}/lib TEST_DIRS=$(shell dirname $(wildcard */Makefile)) -Makefile: ${TEST_DIRS} FORCE +DIRS=googletest hello-simulator kaleidoscope common +CLEANDIRS = $(DIRS:%=clean-%) + +.PHONY: subdirs $(CLEANDIRS) +.PHONY: subdirs $(DIRS) + +clean: googletest/Makefile $(CLEANDIRS) + rm -rf "$(COMMON_LIB_DIR)" + +$(CLEANDIRS): + cd $(@:clean-%=%) && $(MAKE) clean + +all: ${TEST_DIRS} @echo TEST_DIRS="${TEST_DIRS}" -googletest: FORCE +googletest: googletest/Makefile cd googletest && $(MAKE) -common: FORCE - cd common && env COMMON_LIB_DIR="${COMMON_LIB_DIR}" $(MAKE) +googletest/Makefile: + cd googletest && cmake . -clean: - rm -rf "${COMMON_LIB_DIR}" - cd googletest && make clean - cd common && make clean - cd hello-simulator && make clean - cd kaleidoscope && make clean +common: + cd common && COMMON_LIB_DIR="${COMMON_LIB_DIR}" $(MAKE) hello-simulator: @: -%: common googletest FORCE +%: common googletest cd "$@" && $(MAKE) -.PHONY: FORCE googletest build-libs +.PHONY: googletest build-libs common diff --git a/testing/TODO.txt b/testing/TODO.txt index 485ad625..31a92145 100644 --- a/testing/TODO.txt +++ b/testing/TODO.txt @@ -4,10 +4,12 @@ Current behavior - `make` builds googletest, common, kaleidoscope, and issue_840 - This is intended :) - It is also intended that hello-simulator be omitted, since it has a test which is intended to fail to smoke test the framework -- `make clean` builds googletest, common, kaleidoscope, and issue_840, then manually runs make clean for each +FIXED - `make clean` builds googletest, common, kaleidoscope, and issue_840, then manually runs make clean for each - Err... not intended - - Ideally `make clean` would recursively invoke `make clean` or equivalent -- `make issue_840` (or another target in $(TEST_DIRS)) builds googletest, common, kaleidoscope, and issue_840 + + +FIXED - Ideally `make clean` would recursively invoke `make clean` or equivalent +FIXED - `make issue_840` (or another target in $(TEST_DIRS)) builds googletest, common, kaleidoscope, and issue_840 - Not intended - Should just build googletest, common, and the target director (issue_840 in this case) Desired (currently missing) behavior diff --git a/testing/common/Makefile b/testing/common/Makefile index bd24989b..43cd09fd 100644 --- a/testing/common/Makefile +++ b/testing/common/Makefile @@ -5,7 +5,7 @@ CXX_FILES=$(wildcard *.cpp) LIB_FILE=libcommon.a OBJ_FILES=$(patsubst %.cpp,${OBJ_DIR}/%.o,$(CXX_FILES)) -Makefile: ${OBJ_FILES} ${COMMON_LIB_DIR}/${LIB_FILE} +all: ${OBJ_FILES} ${COMMON_LIB_DIR}/${LIB_FILE} @: ${COMMON_LIB_DIR}/${LIB_FILE}: ${OBJ_FILES}