Skip to content

Instantly share code, notes, and snippets.

@chadyred
Created June 14, 2017 10:05
Show Gist options
  • Save chadyred/e29611e3449085a96ebddaa050468173 to your computer and use it in GitHub Desktop.
Save chadyred/e29611e3449085a96ebddaa050468173 to your computer and use it in GitHub Desktop.
Make recursion subfolder
PUBLIC_DIR := public
SRC_DIR := src
CP := $(which cp)
RM := $(which rm)
PROJECTS_SRC := $(wildcard $(SRC_DIR)/*)
PROJECTS_PUBLIC := $(subst $(SRC_DIR)/,$(PUBLIC_DIR)/,$(PROJECTS_SRC))
install: $(PROJECTS_SRC)
$(PROJECTS_SRC): clear/$(PUBLIC_DIR)
$(MAKE) -C $@
cp -r $@ $(subst clear/,,$<)
$(PUBLIC_DIR):
mkdir -p $(PUBLIC_DIR)
clear/$(PUBLIC_DIR): | $(PUBLIC_DIR)
rm -rf $(PUBLIC_DIR)/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment