Created
March 25, 2014 14:03
-
-
Save maglar0/9762505 to your computer and use it in GitHub Desktop.
Makefile for building a React.js project using JSX and almond, while using requirejs and JSXTransformer during development. See discussion at https://github.com/seiffert/require-jsx/issues/1
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
| NODE_MODULES=../node_modules | |
| JSX=$(NODE_MODULES)/react-tools/bin/jsx | |
| R=$(NODE_MODULES)/requirejs/bin/r.js | |
| BUILD_JSX=build/jsx | |
| SOURCE_JSX=js2/app/jsx | |
| BUILD_APP=build/app | |
| SOURCE_APP=js2/app | |
| BUILD_LIB=build/lib | |
| SOURCE_LIB=js2/lib | |
| JSX_TARGETS=$(shell find $(SOURCE_JSX) -name "*.js*" -print | xargs -n 1 basename | xargs -n 1 printf "%s/%s\n" $(BUILD_JSX)) | |
| APP_TARGETS=$(shell find $(SOURCE_APP) -depth 1 -name "*.js" -print | xargs -n 1 basename | xargs -n 1 printf "%s/%s\n" $(BUILD_APP)) | |
| .PHONY: all clean | |
| all: js2/main-built.js | |
| clean: | |
| rm -f js2/main-built.js | |
| rm -f js2/main-built.js.gz | |
| rm -f $(BUILD_JSX)/*.js | |
| rm -f $(BUILD_APP)/*.js | |
| rm -f $(BUILD_LIB)/*.js | |
| js2/main-built.js: $(JSX_TARGETS) $(APP_TARGETS) js2/lib/*.js js2/build.js $(BUILD_LIB)/almond.js | |
| $(R) -o js2/build.js | |
| $(BUILD_JSX)/%.js: $(SOURCE_JSX)/%.js | |
| mkdir -p $(BUILD_JSX) | |
| $(JSX) $< | sed s'/jsx!//g' > $@ | |
| $(BUILD_APP)/%.js: $(SOURCE_APP)/%.js | |
| echo "output: " $@ | |
| echo "input: " $< | |
| mkdir -p $(BUILD_APP) | |
| sed s'/jsx!//g' $< > $@ | |
| $(BUILD_LIB)/almond.js: $(SOURCE_LIB)/almond.js | |
| mkdir -p $(BUILD_LIB) | |
| cp $< $@ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment