Last active
March 6, 2018 17:02
-
-
Save naholyr/8e8be42cb19eabbe826a to your computer and use it in GitHub Desktop.
browserify-friendly Makefile
This file contains 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
# Main entry point | |
SOURCE = src/app.js | |
# The dependencies (other than node_modules/**) | |
LIBS = $(shell ls src/lib/*.js src/components/*.js) | |
# The target | |
TARGET = build/app.js | |
# Compilation flags | |
FLAGS = -t reactify -t es6ify | |
# Enable sourcemap with "make sourcemap=1" | |
ifdef sourcemap | |
FLAGS += --debug | |
endif | |
# Binaries | |
WATCHIFY = ./node_modules/.bin/watchify | |
BROWSERIFY = ./node_modules/.bin/browserify | |
NPM = npm | |
.PHONY: build clean watch | |
build: $(TARGET) | |
clean: | |
rm -f $(TARGET) | |
watch: | |
$(WATCHIFY) --verbose $(FLAGS) -o $(TARGET) -- $(SOURCE) | |
# Note: browserify --list is so slow, just rely on node_modules | |
$(TARGET): $(SOURCE) $(LIBS) node_modules | |
$(BROWSERIFY) $(FLAGS) -o $@ -- $< | |
node_modules: | |
$(NPM) install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment