| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | #**********************************************************************
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # ImageGrid.Viewer Makefile...
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Make dependencies that need to be installed:
 | 
					
						
							| 
									
										
										
										
											2018-01-09 06:44:26 +03:00
										 |  |  | # 	- nodejs / npm 
 | 
					
						
							|  |  |  | # 		also nodejs-legacy seems to be required by some code...
 | 
					
						
							| 
									
										
										
										
											2018-01-10 04:24:55 +03:00
										 |  |  | # 	- npm i -g electron electron-rebuild asar less
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # 	- wget
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | # 	- zip / unzip / zipnote
 | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | # 		if zipnote fails this is likely due to a bug in v3.0, to
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | # 		fix this by either upgrading to 3.1 or a patched version
 | 
					
						
							|  |  |  | # 		of 3.0...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | # 		for more info and patch see: 
 | 
					
						
							|  |  |  | # 			https://goo.gl/csQmQo
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # 	- Windows
 | 
					
						
							|  |  |  | # 		- MSVS -- to build node modules (sharp)
 | 
					
						
							|  |  |  | # 		- WiX
 | 
					
						
							|  |  |  | #	- Linux
 | 
					
						
							|  |  |  | #	- macOS
 | 
					
						
							|  |  |  | #	- iOS
 | 
					
						
							|  |  |  | # 	- Android
 | 
					
						
							|  |  |  | # 	- web
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-10 05:18:46 +03:00
										 |  |  | # Variables to control the build:
 | 
					
						
							|  |  |  | # 	APP_NAME	- Application name
 | 
					
						
							|  |  |  | # 	APP_BIN		- App binary name (ignored for MacOS)
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # 	ARCH		- target achitecture (ia32, x86)
 | 
					
						
							|  |  |  | # 	TARGET_OS	- target OS (win32, linux, darwin)
 | 
					
						
							|  |  |  | # 	ELECTRON_DOWNOAD_URL
 | 
					
						
							|  |  |  | # 			- URL to download electron pinary
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | # 	BUILD_MODE	- can be "repack" or "in-place" (default)
 | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | # NOTE: when setting variables avoid using spaces and other characters 
 | 
					
						
							|  |  |  | # 	make can get fussy about...
 | 
					
						
							|  |  |  | # NOTE: to do a repack build call:
 | 
					
						
							|  |  |  | # 		(export BUILD_MODE=repack && make)
 | 
					
						
							| 
									
										
										
										
											2018-01-10 05:18:46 +03:00
										 |  |  | # NOTE: cross compilation is at this time not supported, if you try it 
 | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | # 	and it works then 1) you got very lucky and 2) tell me about it =)
 | 
					
						
							| 
									
										
										
										
											2018-01-10 05:18:46 +03:00
										 |  |  | # 	...at least the node native packages (sharp) will likely either 
 | 
					
						
							|  |  |  | # 	fail or	win get compiled to the wrong arch and not be used and
 | 
					
						
							|  |  |  | # 	for the most part ImageGrid is cleaver about and will simply not
 | 
					
						
							|  |  |  | # 	load the depending features...
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # ToDo:
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | # 	- app icons...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | # 	- might be a good idea to do a no-bin target -- exclude native...
 | 
					
						
							|  |  |  | # 	- add a cli-only build
 | 
					
						
							|  |  |  | # 	- installers:
 | 
					
						
							|  |  |  | # 		- msi
 | 
					
						
							|  |  |  | # 		- deb
 | 
					
						
							|  |  |  | # 		- ...
 | 
					
						
							|  |  |  | # 	- cross-compiling support...
 | 
					
						
							|  |  |  | # 	- upstream clean build: git clone -> make dist
 | 
					
						
							|  |  |  | # 	- nwjs???
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | # variables...
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | APP_NAME ?= ImageGrid.Viewer | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | # XXX get version...
 | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | VERSION ?= 4.0.0a | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | # Electron stuff...
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | #
 | 
					
						
							|  |  |  | # NOTE: Linux does not let an app run if some of the libs it is dynamically 
 | 
					
						
							|  |  |  | # 	linked against are missing, this can happen if we try to run electron
 | 
					
						
							|  |  |  | # 	on a non-GUI box (i.e. no gtk)...
 | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | # 	...love the "statically" linked "dynamic" libs...
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | ELECTRON_VERSION_FALLBACK = v1.8.1 | 
					
						
							|  |  |  | ELECTRON_VERSION := $(strip $(shell electron -v || echo $(ELECTRON_VERSION_FALLBACK))) | 
					
						
							|  |  |  | ELECTRON_DOWNOAD_URL ?= https://github.com/electron/electron/releases/download | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | BUILD_MODE ?= in-place | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # OS-specific stuff...
 | 
					
						
							|  |  |  | ifeq ($(OS),Windows_NT) | 
					
						
							| 
									
										
										
										
											2018-01-09 03:28:06 +03:00
										 |  |  | 	# NOTE: this is electron naming convention... | 
					
						
							| 
									
										
										
										
											2018-01-10 05:18:46 +03:00
										 |  |  | 	TARGET_OS ?= win32 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:28:06 +03:00
										 |  |  | 	# set arch... | 
					
						
							|  |  |  | 	ifeq ($(PROCESSOR_ARCHITEW6432),AMD64) | 
					
						
							|  |  |  | 		ARCH ?= x64 | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) | 
					
						
							|  |  |  | 			ARCH ?= x64 | 
					
						
							|  |  |  | 		endif | 
					
						
							|  |  |  | 		ifeq ($(PROCESSOR_ARCHITECTURE),x86) | 
					
						
							|  |  |  | 			ARCH ?= ia32 | 
					
						
							|  |  |  | 		endif | 
					
						
							|  |  |  | 	endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | else | 
					
						
							|  |  |  | 	ifeq ($(shell uname -s),Linux) | 
					
						
							| 
									
										
										
										
											2018-01-10 05:18:46 +03:00
										 |  |  | 		TARGET_OS ?= linux | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | 	endif | 
					
						
							|  |  |  | 	ifeq ($(shell uname -s),Darwin) | 
					
						
							| 
									
										
										
										
											2018-01-10 05:18:46 +03:00
										 |  |  | 		TARGET_OS ?= darwin | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2018-01-09 03:28:06 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	# set arch... | 
					
						
							| 
									
										
										
										
											2018-01-09 21:49:23 +03:00
										 |  |  | 	ifeq ($(shell uname -m),x86_64) | 
					
						
							|  |  |  | 		ARCH ?= x64 | 
					
						
							|  |  |  | 	endif | 
					
						
							|  |  |  | 	ifneq ($(filter %86,$(shell uname -p)),) | 
					
						
							|  |  |  | 		ARCH ?= ia32 | 
					
						
							|  |  |  | 	endif | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | # setup path and file naming stuff...
 | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | ifeq ($(TARGET_OS),win32) | 
					
						
							|  |  |  | 	APP_BIN ?= ig | 
					
						
							|  |  |  | 	ELECTRON_BIN = electron | 
					
						
							|  |  |  | 	ASAR_PATH = resources | 
					
						
							|  |  |  | 	EXT = .exe | 
					
						
							|  |  |  | 	DLLs = "$@/"*dll | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | ifeq ($(TARGET_OS),linux) | 
					
						
							|  |  |  | 	APP_BIN ?= ig | 
					
						
							|  |  |  | 	ELECTRON_BIN = electron | 
					
						
							|  |  |  | 	ASAR_PATH = resources | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | ifeq ($(TARGET_OS),darwin) | 
					
						
							|  |  |  | 	APP_BIN ?= $(APP_NAME) | 
					
						
							|  |  |  | 	ELECTRON_BIN = Electron | 
					
						
							|  |  |  | 	ASAR_PATH = Electron.app/Contents/Resources | 
					
						
							|  |  |  | 	EXT = .app | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | # Built-in make stuff...
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | # NOTE: some of the targets are directories so this will enable GNUMake's
 | 
					
						
							|  |  |  | # 	automatic cleanup to work.
 | 
					
						
							|  |  |  | # 	...not sure if this is the right way to go...
 | 
					
						
							| 
									
										
										
										
											2018-01-09 21:40:56 +03:00
										 |  |  | RM += -r | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | MD = @mkdir -p | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:28:06 +03:00
										 |  |  | # Paths and lists...
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | TARGET_DIR = targets | 
					
						
							|  |  |  | DIST_DIR = dist | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | # NOTE: this can not contain spaces...
 | 
					
						
							|  |  |  | BUILD_DIR = build | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | NODE_DIR = node_modules | 
					
						
							|  |  |  | LIB_DIR = lib | 
					
						
							|  |  |  | EXT_LIB_DIR = ext-lib | 
					
						
							|  |  |  | CSS_DIR = css | 
					
						
							|  |  |  | CFG_DIR = cfg | 
					
						
							|  |  |  | DOMAIN_DIR = imagegrid | 
					
						
							|  |  |  | FEATURES_DIR = features | 
					
						
							|  |  |  | WORKERS_DIR = workers | 
					
						
							|  |  |  | IMAGES_DIR = images | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 06:44:26 +03:00
										 |  |  | BUILD_DATE = $(BUILD_DIR)/DATE | 
					
						
							| 
									
										
										
										
											2018-01-09 02:36:02 +03:00
										 |  |  | PROJECT_FILES = package.json | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | # get all .css build targets, in addition, get all the .less files and 
 | 
					
						
							|  |  |  | # replace .less with .css making them build targets...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | CSS_FILES := $(patsubst %.less,%.css,$(wildcard css/*.less)) | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | HTML_FILES := $(wildcard *.html) | 
					
						
							| 
									
										
										
										
											2018-01-09 03:28:06 +03:00
										 |  |  | JS_FILES := $(wildcard *.js) | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | # XXX do we actually use preact???
 | 
					
						
							|  |  |  | INCLUDE_NODE_MODULES = ig-object ig-actions ig-features preact | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | # dependencies to check...
 | 
					
						
							|  |  |  | # XXX might be a good idea to split these to sections and check only what
 | 
					
						
							|  |  |  | # 	is needed...
 | 
					
						
							|  |  |  | # 	...like: base, electron, wix, ...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | DEPENDENCIES = npm wget zip unzip zipnote \
 | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 	lessc electron electron-rebuild asar | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | # WiX dependencies...
 | 
					
						
							|  |  |  | #DEPENDENCIES += heat candle light
 | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | # User targets...
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | all: check dev dist | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | css: $(CSS_FILES) | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | dev: $(NODE_DIR) css | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | clean: | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | 	$(RM) $(BUILD_DIR) | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | cleanall: clean | 
					
						
							| 
									
										
										
										
											2018-01-09 23:26:00 +03:00
										 |  |  | 	$(RM) $(DIST_DIR) $(TARGET_DIR) $(NODE_DIR) | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | electron-dist: $(DIST_DIR)/$(APP_NAME)-$(VERSION)-$(TARGET_OS)-$(ARCH).zip | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | #electron-inst: $(DIST_DIR)/$(APP_NAME)-$(VERSION)-$(TARGET_OS)-$(ARCH).msi
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | dist: electron-dist | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | web: $(DIST_DIR)/$(APP_NAME)-$(VERSION)-web.zip | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: all css dev clean cleanall dist web dist-in-place \ | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | 	electron-dist electron-inst electron-dist-in-place | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #**********************************************************************
 | 
					
						
							|  |  |  | # Dependency checking...
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require(%): | 
					
						
							|  |  |  | 	@echo Checking for: $* | 
					
						
							|  |  |  | 	@which $* > /dev/null | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | .PHONY: check | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | check: $(foreach dep,$(DEPENDENCIES),require($(dep))) | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | # build rules...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | NODE_MODULES_MINIMAL = $(foreach m,$(INCLUDE_NODE_MODULES),$(BUILD_DIR)/$(APP_NAME)/$(NODE_DIR)/$(m)) | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | PACK_MINIMAL = $(BUILD_DIR)/$(APP_NAME) $(NODE_MODULES_MINIMAL) | 
					
						
							|  |  |  | PACK_FULL = $(BUILD_DIR)/$(APP_NAME) $(BUILD_DIR)/$(APP_NAME)/$(NODE_DIR) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | # build date...
 | 
					
						
							| 
									
										
										
										
											2017-05-13 17:47:40 +03:00
										 |  |  | # XXX add build version...
 | 
					
						
							| 
									
										
										
										
											2018-01-09 06:44:26 +03:00
										 |  |  | $(BUILD_DATE): $(CSS_FILES) $(NODE_DIR) $(PROJECT_FILES) \ | 
					
						
							| 
									
										
										
										
											2018-01-08 08:23:02 +03:00
										 |  |  | 		$(JS_FILES) $(CSS_FILES) $(HTML_FILES) | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 	$(MD) "$(@D)" | 
					
						
							| 
									
										
										
										
											2018-01-09 06:44:26 +03:00
										 |  |  | 	date "+%Y%m%d %H%M" > $(BUILD_DATE) | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | %.css: %.less | 
					
						
							|  |  |  | 	lessc $< > $@ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | # XXX need to make this arch/os specific for cross compiling...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | $(NODE_DIR): | 
					
						
							|  |  |  | 	npm install | 
					
						
							| 
									
										
										
										
											2018-01-09 23:26:00 +03:00
										 |  |  | 	electron-rebuild | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-26 07:56:26 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | # build app dir...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME): $(CSS_FILES) $(PROJECT_FILES) \ | 
					
						
							| 
									
										
										
										
											2018-01-08 08:23:02 +03:00
										 |  |  | 		$(JS_FILES) $(CSS_FILES) $(HTML_FILES) \
 | 
					
						
							| 
									
										
										
										
											2018-01-09 06:44:26 +03:00
										 |  |  | 		$(BUILD_DATE) | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	$(MD) "$@" | 
					
						
							| 
									
										
										
										
											2018-01-09 21:32:11 +03:00
										 |  |  | 	cp -r $(PROJECT_FILES) $(JS_FILES) $(HTML_FILES) \
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 		$(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-09 06:44:26 +03:00
										 |  |  | 		$(BUILD_DATE) \
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 		"$(BUILD_DIR)/$(APP_NAME)" | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | 	@touch "$@" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # add $(NODE_DIR) to app dir...
 | 
					
						
							|  |  |  | # NOTE: making $(NODE_DIR) a link/junction would be quite a bit faster 
 | 
					
						
							|  |  |  | # 	but it will also choke asar...
 | 
					
						
							|  |  |  | $(BUILD_DIR)/$(APP_NAME)/$(NODE_DIR): $(NODE_DIR) | 
					
						
							|  |  |  | 	$(MD) "$@" | 
					
						
							|  |  |  | 	cp -r "$(NODE_DIR)" "$(@D)" | 
					
						
							|  |  |  | 	@touch "$@" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | # add ig-* $(NODE_DIR) modules...
 | 
					
						
							|  |  |  | $(BUILD_DIR)/$(APP_NAME)/$(NODE_DIR)/%: $(NODE_DIR) | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | 	$(MD) "$(@D)" | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | 	cp -r "$(NODE_DIR)/$*" "$(@D)" | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | 	@touch "$@" | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | # targets for testing...
 | 
					
						
							|  |  |  | # NOTE: do not use these phony targets as dependencies...
 | 
					
						
							|  |  |  | .PHONY: app-dir-full app-dir-minimal | 
					
						
							|  |  |  | app-dir-full: $(PACK_FULL) | 
					
						
							|  |  |  | app-dir-minimal: $(PACK_MINIMAL) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | # Web...
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $(DIST_DIR)/$(APP_NAME)-$(VERSION)-web.zip: $(PACK_MINIMAL) | 
					
						
							|  |  |  | 	$(MD) "$(@D)" | 
					
						
							|  |  |  | 	$(call zipfrom,$<,$@,*) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | # Electron desktop build...
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | # helpers...
 | 
					
						
							|  |  |  | up = $(subst $(eval) ,/,$(foreach x,$(subst /, ,$1),..)) | 
					
						
							|  |  |  | zipfrom = cd $1 ; zip -r "$(call up,$1)/$2" $3 | 
					
						
							|  |  |  | zipdelfrom = cd $1 ; zip -d "$(call up,$1)/$2" $3 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # pack app.asar (electron-specific)...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | .PRECIOUS: $(BUILD_DIR)/app.asar | 
					
						
							|  |  |  | # XXX do we need to track changes to pack-full or to build it only if 
 | 
					
						
							|  |  |  | # 	app.asar is deleted?
 | 
					
						
							|  |  |  | #$(BUILD_DIR)/app.asar:
 | 
					
						
							|  |  |  | #	make check $(PACK_FULL)
 | 
					
						
							|  |  |  | $(BUILD_DIR)/app.asar: $(PACK_FULL) | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 	cd $(BUILD_DIR) ; \
 | 
					
						
							| 
									
										
										
										
											2018-01-11 04:04:22 +03:00
										 |  |  | 		asar p "$(APP_NAME)" app.asar \
 | 
					
						
							|  |  |  | 			--unpack-dir node_modules/sharp | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-09 18:39:01 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:28:06 +03:00
										 |  |  | # get the electron binary (keep this cached)...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:46:38 +03:00
										 |  |  | .PRECIOUS: $(TARGET_DIR)/electron-$(ELECTRON_VERSION)-%.zip | 
					
						
							|  |  |  | $(TARGET_DIR)/electron-$(ELECTRON_VERSION)-%.zip: | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	$(MD) "$(@D)" | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 	wget \
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:46:38 +03:00
										 |  |  | 		-nc "$(ELECTRON_DOWNOAD_URL)/$(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-09 03:28:06 +03:00
										 |  |  | # build the app dir (electron-specific)...
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | # XXX need to setup app icons...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | .PRECIOUS: $(BUILD_DIR)/$(APP_NAME)-% | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME)-$(VERSION)-%: $(TARGET_DIR)/electron-$(ELECTRON_VERSION)-%.zip \ | 
					
						
							| 
									
										
										
										
											2018-01-09 06:44:26 +03:00
										 |  |  | 		$(BUILD_DIR)/app.asar $(BUILD_DATE) | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 	unzip -u "$<" -d "$@"  | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | 	cp -r $(BUILD_DIR)/app.asar* "$@/$(ASAR_PATH)/" | 
					
						
							| 
									
										
										
										
											2018-01-09 06:44:26 +03:00
										 |  |  | 	cp -f "$(BUILD_DATE)" "$@/" | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	# remove default_app.asar... | 
					
						
							| 
									
										
										
										
											2018-01-09 22:06:57 +03:00
										 |  |  | 	$(RM) "$@/$(ASAR_PATH)/default_app.asar" | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | #	# setup app icon...
 | 
					
						
							|  |  |  | #	# XXX
 | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	# rename app dir in zip... | 
					
						
							| 
									
										
										
										
											2018-01-09 22:29:00 +03:00
										 |  |  | 	mv "$@/$(ELECTRON_BIN)$(EXT)" "$@/$(APP_BIN)$(EXT)" | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	# fix permissions... | 
					
						
							| 
									
										
										
										
											2018-01-09 06:44:26 +03:00
										 |  |  | 	chmod +x "$@/$(APP_BIN)$(EXT)" $(DLLs) | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | 	@touch "$@" | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | # modify the archive in place (electron-specific)...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | # XXX need to setup app icons...
 | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME)-$(VERSION)-%.in-place.zip: $(TARGET_DIR)/electron-$(ELECTRON_VERSION)-%.zip \ | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 		$(BUILD_DIR)/app.asar $(BUILD_DATE) | 
					
						
							|  |  |  | 	cp "$<" "$@.tmp" | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | #	# setup app icon...
 | 
					
						
							|  |  |  | #	# XXX
 | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	# remove default_app.asar... | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 	$(call zipdelfrom,"$(BUILD_DIR)",$@.tmp,"$(ASAR_PATH)/default_app.asar") | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	# add app.asar... | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 	$(MD) "$(BUILD_DIR)/$(ASAR_PATH)" | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | 	cp -r $(BUILD_DIR)/app.asar* "$(BUILD_DIR)/$(ASAR_PATH)/" | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 	$(call zipfrom,"$(BUILD_DIR)",$@.tmp,"$(ASAR_PATH)" "$(notdir $(BUILD_DATE))") | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | 	# rename app in zip... | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 	zipnote "$@.tmp" \
 | 
					
						
							| 
									
										
										
										
											2018-01-11 04:17:35 +03:00
										 |  |  | 		| sed 's/\(^@ $(ELECTRON_BIN)$(EXT)\)\(.*$$\)/\1\2\n@=$(APP_BIN)$(EXT)\2/' \
 | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 		| zipnote -w "$@.tmp" | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	# cleanup... | 
					
						
							|  |  |  | 	$(RM) $(BUILD_DIR)/$(firstword $(subst /, ,$(ASAR_PATH))) | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 	mv "$@.tmp" "$@" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | # package the app dir (unpack - update - repack)...
 | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME)-$(VERSION)-%.repack.zip: $(BUILD_DIR)/$(APP_NAME)-% | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 	$(MD) "$(@D)" | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 	$(call zipfrom,$<,$@,*) | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | # collect the built package to $(DIST_DIR)
 | 
					
						
							|  |  |  | $(DIST_DIR)/$(APP_NAME)-%.zip: $(BUILD_DIR)/$(APP_NAME)-%.$(BUILD_MODE).zip | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | 	$(MD) "$(@D)" | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | 	cp "$<" "$@" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | # Desktop installer...
 | 
					
						
							| 
									
										
										
										
											2016-04-30 03:38:52 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # installer (WiX)...
 | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | # XXX add tools to path...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | # harvest directory tree...
 | 
					
						
							|  |  |  | %.wxs: | 
					
						
							|  |  |  | 	heat dir $* -gg -o $< | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # XXX provide -arch x64/ia32...
 | 
					
						
							|  |  |  | %.wixobj: %.wsx | 
					
						
							|  |  |  | 	candle -o $@ $< | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | %.msi: %.wixobj | 
					
						
							|  |  |  | 	light -o $@ $< | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # installer (WiX)...
 | 
					
						
							|  |  |  | $(DIST_DIR)/$(APP_NAME)-%.msi: $(BUILD_DIR)/$(APP_NAME)-% $(BUILD_DIR)/$(APP_NAME).wxs | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | 	$(MD) "$(@D)" | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							|  |  |  | # Mobile XXX
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | #						       vim:set nowrap :
 |