Last active
September 27, 2019 20:27
-
-
Save aprxi/14ccc84bed71b349ddaa7d6ed63a9fca to your computer and use it in GitHub Desktop.
Makefile-fork
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: fork | |
FILES = \ | |
module files Makefile Dockerfile docker-compose.yml setup.py MANIFEST.in variables .gitignore .pylintrc | |
DEST ?= $(dest) | |
fork: | |
ifeq ($(DEST),) | |
@echo 'MISSING "dest=" PARAMETER' | |
@echo 'RUN: make fork dest=$${DIRECTORY}' | |
else | |
@# copy when either directory does not exist, or is empty | |
@# skip if a non-empty directory exist | |
@# Note this excludes README.md and LICENSE -- you own your own project ;) | |
@(([ ! -d "$(DEST)" ] || find "$(DEST)" -prune -type d -empty |grep -q .) \ | |
&& mkdir -p "$(DEST)" \ | |
&& cp -R $(FILES) "$(DEST)/" \ | |
&& touch $(DEST)/README.md \ | |
|| echo "SKIPPING FORK, WON'T OVERWRITE EXISTING DIRECTORY") | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment