| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | #**********************************************************************
 | 
					
						
							|  |  |  | # TODO: build to a BUILD_DIR...
 | 
					
						
							|  |  |  | # TODO: build all target platforms...
 | 
					
						
							|  |  |  | #	- Windows (AppJS)
 | 
					
						
							|  |  |  | #	- MacOSX (AppJS)
 | 
					
						
							|  |  |  | #	- Windows8 (native?) XXX
 | 
					
						
							|  |  |  | #	- PhoneGap-remote
 | 
					
						
							|  |  |  | #	  push and api call to fetch and rebuild
 | 
					
						
							|  |  |  | #	- PhoneGap-local XXX
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | APP_NAME=ImageGrid.Viewer | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | ELECTRON_DOWNOAD_URL=https://github.com/electron/electron/releases/download | 
					
						
							| 
									
										
										
										
											2016-04-09 18:39:01 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | # XXX get this automatically...
 | 
					
						
							|  |  |  | # 	...also might be good to make this flexible and use these as parameters...
 | 
					
						
							|  |  |  | ELECTRON_VERSION=1.7.10 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | NODE_VERSION=`node --version` | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | UNAME := $(shell uname) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | #**********************************************************************
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | TARGET_DIR=targets | 
					
						
							|  |  |  | NODE_DIR=node_modules | 
					
						
							|  |  |  | BUILD_DIR=build | 
					
						
							|  |  |  | DIST_DIR=dist | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | LIB_DIR=lib | 
					
						
							|  |  |  | EXT_LIB_DIR=ext-lib | 
					
						
							|  |  |  | CSS_DIR=css | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | CFG_DIR=cfg | 
					
						
							| 
									
										
										
										
											2016-06-01 21:19:24 +03:00
										 |  |  | DOMAIN_DIR=imagegrid | 
					
						
							| 
									
										
										
										
											2016-04-30 03:38:52 +03:00
										 |  |  | FEATURES_DIR=features | 
					
						
							| 
									
										
										
										
											2016-05-26 05:36:28 +03:00
										 |  |  | WORKERS_DIR=workers | 
					
						
							| 
									
										
										
										
											2016-06-04 21:53:17 +03:00
										 |  |  | IMAGES_DIR=images | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | # get all the .less files to process...
 | 
					
						
							|  |  |  | #LESS_FILES := $(shell find . -type f -name '*.less')
 | 
					
						
							|  |  |  | CSS_FILES := $(patsubst %.less,%.css,$(wildcard css/*.less)) | 
					
						
							|  |  |  | PROJECT_FILES=package.json | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | JS_FILES := $(wildcard *.js) | 
					
						
							|  |  |  | HTML_FILES := $(wildcard *.html) | 
					
						
							| 
									
										
										
										
											2014-11-16 04:40:32 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | APP_DATE=$(BUILD_DIR)/DATE | 
					
						
							|  |  |  | APP_NODE=$(BUILD_DIR)/NODE | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | .PHONY: all css dev clean cleanall win64e win32e | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | all: dev | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | css: $(CSS_FILES) | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | dev: $(NODE_DIR) css | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | #clean:
 | 
					
						
							|  |  |  | #	rm -rf $(BUILD_DIR)
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | # XXX for some reason this is called on make win64e...
 | 
					
						
							|  |  |  | #cleanall: clean
 | 
					
						
							|  |  |  | #	rm -rf $(DIST_DIR) $(TARGET_DIR)
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | # XXX these still depend on the current arch, need to pass architecture to npm...
 | 
					
						
							|  |  |  | win64e: $(DIST_DIR)/$(APP_NAME)-win32-x64.zip | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | win32e: $(DIST_DIR)/$(APP_NAME)-win32-ia32.zip | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | # build targets...
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-13 17:47:40 +03:00
										 |  |  | # build info...
 | 
					
						
							|  |  |  | # XXX add build version...
 | 
					
						
							|  |  |  | $(APP_DATE): | 
					
						
							|  |  |  | 	date "+%Y%m%d %H%M" > $(APP_DATE) | 
					
						
							|  |  |  | $(APP_NODE): | 
					
						
							|  |  |  | 	echo "$(NODE_VERSION)" > $(APP_NODE) | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | $(NODE_DIR): | 
					
						
							|  |  |  | 	npm install | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-26 07:56:26 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | # process LESS files to CSS...
 | 
					
						
							|  |  |  | %.css: %.less | 
					
						
							|  |  |  | 	lessc $< > $@ | 
					
						
							| 
									
										
										
										
											2017-11-26 07:56:26 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | # build app dir...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | # XXX need to make this arch/os specific...
 | 
					
						
							|  |  |  | # XXX make junction to $(NODE_DIR) -- does not work with asar
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME): $(CSS_FILES) $(NODE_DIR) $(PROJECT_FILES) \ | 
					
						
							|  |  |  | 		$(JS_FILES) $(CSS_FILES) $(HTML_FILES) | 
					
						
							|  |  |  | 	@mkdir -p $@ | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 	cp -rlu $(PROJECT_FILES) $(JS_FILES) $(HTML_FILES) \
 | 
					
						
							|  |  |  | 		$(CFG_DIR) $(LIB_DIR) $(EXT_LIB_DIR) $(FEATURES_DIR) \
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 		$(DOMAIN_DIR) $(WORKERS_DIR) $(CSS_DIR) $(IMAGES_DIR) \
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 		"$(BUILD_DIR)/$(APP_NAME)" | 
					
						
							|  |  |  | 	cp -rlu $(NODE_DIR) \
 | 
					
						
							|  |  |  | 		"$(BUILD_DIR)/$(APP_NAME)" | 
					
						
							|  |  |  | 	#ln -s $(NODE_DIR) "$(BUILD_DIR)/$(APP_NAME)/$(NODE_DIR)" | 
					
						
							|  |  |  | 	#cmd /c mklink /j "$(BUILD_DIR)\$(APP_NAME)\$(NODE_DIR)" \ | 
					
						
							|  |  |  | 	#	$(NODE_DIR)  | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | # pack app.asar
 | 
					
						
							|  |  |  | # XXX need to do $(BUILD_DIR)/$(APP_NAME) iff app.asar does not exist...
 | 
					
						
							|  |  |  | $(BUILD_DIR)/app.asar: $(BUILD_DIR)/$(APP_NAME) | 
					
						
							|  |  |  | 	cd $(BUILD_DIR) ; \
 | 
					
						
							|  |  |  | 		asar p "$(APP_NAME)" app.asar | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-09 18:39:01 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | # get the electron binary...
 | 
					
						
							|  |  |  | # XXX for some odd reason this is deleted adter extraction...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | $(TARGET_DIR)/electron-v$(ELECTRON_VERSION)-%.zip: | 
					
						
							|  |  |  | 	@mkdir -p $(@D) | 
					
						
							|  |  |  | 	wget \
 | 
					
						
							|  |  |  | 		-nc "$(ELECTRON_DOWNOAD_URL)/v$(ELECTRON_VERSION)/$(@F)" \
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 		-O "$@" | 
					
						
							| 
									
										
										
										
											2014-11-03 06:43:23 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | # build the app dir...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME)-%: $(TARGET_DIR)/electron-v$(ELECTRON_VERSION)-%.zip $(BUILD_DIR)/app.asar | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 	unzip -u "$<" -d "$@"  | 
					
						
							|  |  |  | 	chmod +x "$@/"*dll "$@/"*exe | 
					
						
							|  |  |  | 	cp "$(BUILD_DIR)/app.asar" "$@/resources/" | 
					
						
							|  |  |  | 	rm -f "$@/resources/default_app.asar" | 
					
						
							|  |  |  | 	mv "$@/electron.exe" "$@/$(APP_NAME).exe" | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | # package the app dir...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | $(DIST_DIR)/$(APP_NAME)-%.zip: $(BUILD_DIR)/$(APP_NAME)-% | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 	@mkdir -p "$(@D)" | 
					
						
							|  |  |  | 	cd "$(BUILD_DIR)" ; \
 | 
					
						
							|  |  |  | 		zip -r "../$@" "$(APP_NAME)-$*" | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-30 03:38:52 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-02 15:12:18 +03:00
										 |  |  | # XXX OSX
 | 
					
						
							|  |  |  | # XXX Linux
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | # XXX android...
 | 
					
						
							|  |  |  | # XXX iOS...
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #**********************************************************************
 |