Skip to content

Instantly share code, notes, and snippets.

@ThomasThoren

ThomasThoren/Makefile

Last active Mar 9, 2019
Embed
What would you like to do?
Make

Make

Arguments

Parallel processes.

-j 2
--jobs=2

Variables

$< -- first prerequisite file $^ -- all prerequisite files $@ -- target file $% -- target name ("file" in "file.json")

$(@D) -- target directory $(dir $@) -- target directory $(notdir $@) -- target file name ("file.json" in "/home/user/file.json")

Check if in virtual environment

check_virtualenv:
    @if [ -z $(VIRTUAL_ENV) ]; then \
            echo 'Not in virtual environment. Continuing...'; \
	else \
	    echo 'In virtual environment. Halting.'; \
	    exit 1; \
	fi

Resources

# Default Makefile
# Save as ~/.Makefile or similar and use as starting point for new Makefiles.
PROJECT_DIR=`pwd`
# Keep intermediate files
.SECONDARY:
.PHONY: help
.DEFAULT_GOAL := help
help: ## Prints help list for targets.
@# Source: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
cleanup: ## Removes any temporary files.
@rm -rf tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.