Skip to content

Commit 9e299d4

Browse files
authored
Merge pull request #3452 from infotroph/make-clean-by-wildcard
[build] clean all packages with src dirs
2 parents 9105280 + 31ff9ee commit 9e299d4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

Makefile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ MODELS_D := $(MODELS:%=.doc/%)
4444
MODULES_D := $(MODULES:%=.doc/%)
4545
ALL_PKGS_D := $(BASE_D) $(MODULES_D) $(MODELS_D)
4646

47+
SRCS_TO_CLEAN := $(strip $(foreach d,$(ALL_PKGS),$(wildcard ${d}/src)))
48+
4749
SETROPTIONS := "options(Ncpus = ${NCPUS})"
4850

4951
EXPECTED_ROXYGEN_VERSION := 7.3.2
@@ -101,7 +103,7 @@ depends = .doc/$(1) .install/$(1) .check/$(1) .test/$(1)
101103

102104
### Rules
103105

104-
.PHONY: all install check test document shiny \
106+
.PHONY: all install check test document clean shiny \
105107
check_base check_models check_modules document help
106108

107109
all: install document
@@ -125,13 +127,19 @@ book:
125127
.doc .install .check .test .shiny_depends $(call depends,base) $(call depends,models) $(call depends,modules):
126128
mkdir -p $@
127129

130+
clean:
131+
rm -rf .install .check .test .doc
132+
for p in $(SRCS_TO_CLEAN); do \
133+
find "$$p" \( -name \*.mod -o -name \*.o -o -name \*.so \) -delete; \
134+
done
135+
128136
help:
129137
@echo "Usage: make [target]"
130138
@echo ""
131139
@echo "Examples:"
132140
@echo " make all"
133141
@echo " make document"
134-
@echo " make document modules/assim.sequential # Generate documentation for a specific package"
142+
@echo " make .doc/modules/assim.sequential # Generate documentation for a specific package"
135143
@echo ""
136144
@echo "Notes:"
137145
@echo " - Components not included: cable (models), data.mining and DART (modules)."
@@ -163,11 +171,6 @@ $(subst .doc/models/template,,$(MODELS_D)): .install/models/template
163171
# target need not be rebuilt when a prerequisite changes)
164172
include Makefile.depends
165173

166-
clean:
167-
rm -rf .install .check .test .doc
168-
find modules/rtm/src \( -name \*.mod -o -name \*.o -o -name \*.so \) -delete
169-
find models/basgra/src \( -name \*.mod -o -name \*.o -o -name \*.so \) -delete
170-
171174
.install/devtools: | .install
172175
+ ./scripts/time.sh "devtools ${1}" Rscript -e ${SETROPTIONS} -e "if(!requireNamespace('devtools', quietly = TRUE)) install.packages('devtools')"
173176
echo `date` > $@

0 commit comments

Comments
 (0)