| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | #**********************************************************************
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | # ImageGrid.Viewer Makefile...
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-16 01:13:45 +03:00
										 |  |  | # Make dependencies that need to be installed (make check):
 | 
					
						
							|  |  |  | # 	- General
 | 
					
						
							|  |  |  | #	 	- git
 | 
					
						
							|  |  |  | # 		- nodejs / npm 
 | 
					
						
							|  |  |  | # 			also nodejs-legacy seems to be required by some code...
 | 
					
						
							|  |  |  | # 		- npm i -g electron electron-rebuild asar less
 | 
					
						
							|  |  |  | # 		- wget
 | 
					
						
							|  |  |  | # 		- zip / unzip / zipnote
 | 
					
						
							|  |  |  | # 			if zipnote fails this is likely due to a bug in 
 | 
					
						
							|  |  |  | # 			v3.0, to fix this by either upgrading to 3.1 or 
 | 
					
						
							|  |  |  | # 			a patched version of 3.0...
 | 
					
						
							|  |  |  | # 			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-16 01:13:45 +03:00
										 |  |  | # Build targets:
 | 
					
						
							|  |  |  | # 	check		- check dependencies
 | 
					
						
							|  |  |  | # 	dev		- build the development environment
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # 	app-dir-full	- build full app dir
 | 
					
						
							|  |  |  | # 	app-dir-minimal - build minimal app dir (used for web)
 | 
					
						
							|  |  |  | # 			  NOTE: these are runtime neutral
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # 	web		- build a version runnable in browser
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # 	electron-dist	- electron distribution (default)
 | 
					
						
							|  |  |  | # 	electron-unpacked
 | 
					
						
							|  |  |  | # 			- build an unpacked electron app dir
 | 
					
						
							|  |  |  | # 			  NOTE: this builds to a different directory than
 | 
					
						
							|  |  |  | # 			  	app-dir-*
 | 
					
						
							|  |  |  | # 	electron-insr	- build electron app installer (XXX not implemented)
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # 	cleanall	- clean up fully.
 | 
					
						
							|  |  |  | # 			  removes: ./targets/, ./build/, ./dist/
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											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)
 | 
					
						
							| 
									
										
										
										
											2018-01-16 01:13:45 +03:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-10 05:18:46 +03:00
										 |  |  | # 	ELECTRON_DOWNOAD_URL
 | 
					
						
							|  |  |  | # 			- URL to download electron pinary
 | 
					
						
							| 
									
										
										
										
											2018-01-14 02:09:04 +03:00
										 |  |  | # 	ELECTRON_DIST	- electron distribution file name pattern
 | 
					
						
							| 
									
										
										
										
											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-14 22:23:51 +03:00
										 |  |  | # NOTE: in most cases we do not add a "/" to target dirs to destinguish 
 | 
					
						
							|  |  |  | # 	them from target files except for one case:
 | 
					
						
							|  |  |  | #		$(BUILD_DIR)/$(APP_NAME)-%/
 | 
					
						
							|  |  |  | #	this will help make destinguish it from things like:
 | 
					
						
							|  |  |  | #		$(DIST_DIR)/$(APP_NAME)-%.zip
 | 
					
						
							| 
									
										
										
										
											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-16 01:13:45 +03:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2018-01-14 02:09:04 +03:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | # ToDo:
 | 
					
						
							| 
									
										
										
										
											2018-01-14 02:09:04 +03:00
										 |  |  | # 	- sync version numbers between:
 | 
					
						
							| 
									
										
										
										
											2018-01-16 01:13:45 +03:00
										 |  |  | # 		- git tags (currently not used)
 | 
					
						
							| 
									
										
										
										
											2018-01-14 02:09:04 +03:00
										 |  |  | # 		- package.json
 | 
					
						
							|  |  |  | # 			can't use only this because it can't be imported 
 | 
					
						
							|  |  |  | # 			in browser directly...
 | 
					
						
							| 
									
										
										
										
											2018-01-16 01:13:45 +03:00
										 |  |  | # 			...do we actually need the file:// version working?
 | 
					
						
							| 
									
										
										
										
											2018-01-14 02:09:04 +03:00
										 |  |  | # 		- version.js
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | # 	- app icons...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | # 	- add a cli-only build
 | 
					
						
							|  |  |  | # 	- installers:
 | 
					
						
							| 
									
										
										
										
											2018-01-15 03:59:53 +03:00
										 |  |  | # 		- msi (wix)
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | # 		- deb
 | 
					
						
							| 
									
										
										
										
											2018-01-16 01:13:45 +03:00
										 |  |  | # 		- rpm
 | 
					
						
							|  |  |  | # 	- cross-compiling support (???)
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | # 	- upstream clean build: git clone -> make dist
 | 
					
						
							|  |  |  | # 	- nwjs???
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-15 03:59:53 +03:00
										 |  |  | # Links:
 | 
					
						
							|  |  |  | # 	WiX example...
 | 
					
						
							|  |  |  | # 		https://helgeklein.com/blog/2014/09/real-world-example-wix-msi-application-installer/
 | 
					
						
							|  |  |  | # 	npm modules to abstract WiX...
 | 
					
						
							|  |  |  | # 		https://www.npmjs.com/package/electron-wix-msi
 | 
					
						
							|  |  |  | # 		https://www.npmjs.com/package/electron-builder
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | #
 | 
					
						
							| 
									
										
										
										
											2018-01-08 22:08:16 +03:00
										 |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | .SECONDEXPANSION: | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | # variables...
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03: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-14 02:09:04 +03:00
										 |  |  | VERSION_FALLBACK ?= 4.0.0a | 
					
						
							|  |  |  | # NOTE: we are not using './ig --version 2> /dev/null' because it will 
 | 
					
						
							|  |  |  | # 	not work before we do 'npm install'...
 | 
					
						
							|  |  |  | VERSION := $(strip $(shell \
 | 
					
						
							|  |  |  | 	node version.js \
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | 		|| echo $(VERSION_FALLBACK))) | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | DATE := $(strip $(shell date "+%Y%m%d%H%M")) | 
					
						
							| 
									
										
										
										
											2018-01-12 21:59:08 +03:00
										 |  |  | COMMIT := $(strip $(shell git rev-parse HEAD)) | 
					
						
							| 
									
										
										
										
											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-14 02:09:04 +03:00
										 |  |  | ELECTRON_VERSION_FALLBACK ?= v1.8.1 | 
					
						
							|  |  |  | ELECTRON_VERSION := $(strip $(shell \
 | 
					
						
							|  |  |  | 	electron -v 2> /dev/null \
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | 		|| echo $(ELECTRON_VERSION_FALLBACK))) | 
					
						
							| 
									
										
										
										
											2018-01-09 03:00:33 +03:00
										 |  |  | ELECTRON_DOWNOAD_URL ?= https://github.com/electron/electron/releases/download | 
					
						
							| 
									
										
										
										
											2018-01-12 21:59:08 +03:00
										 |  |  | ELECTRON_DIST ?= electron-$(ELECTRON_VERSION)-$(TARGET_OS)-$(ARCH).zip | 
					
						
							| 
									
										
										
										
											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-12 21:59:08 +03:00
										 |  |  | BUILD_INFO = $(BUILD_DIR)/INFO | 
					
						
							| 
									
										
										
										
											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-13 05:19:45 +03:00
										 |  |  | DEPENDENCIES = node npm wget zip unzip zipnote git \
 | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 	lessc electron electron-rebuild asar | 
					
						
							| 
									
										
										
										
											2018-01-14 02:09:04 +03:00
										 |  |  | # WiX dependencies, windows only...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | #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-14 22:23:51 +03:00
										 |  |  | .PHONY: all | 
					
						
							| 
									
										
										
										
											2018-01-20 03:55:28 +03:00
										 |  |  | all: check dev dist deploy | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | .PHONY: css | 
					
						
							| 
									
										
										
										
											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-14 22:23:51 +03:00
										 |  |  | .PHONY: dev | 
					
						
							| 
									
										
										
										
											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-14 22:23:51 +03:00
										 |  |  | .PHONY: clean | 
					
						
							| 
									
										
										
										
											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-14 22:23:51 +03:00
										 |  |  | .PHONY: cleanall | 
					
						
							| 
									
										
										
										
											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-14 22:23:51 +03:00
										 |  |  | .PHONY: electron-dist | 
					
						
							| 
									
										
										
										
											2018-01-20 03:55:28 +03:00
										 |  |  | electron-dist: VERSION := $(VERSION)-el | 
					
						
							|  |  |  | electron-dist: DIST := $(DIST_DIR)/$(APP_NAME)-$(VERSION)-$(TARGET_OS)-$(ARCH).zip | 
					
						
							|  |  |  | electron-dist: $(DIST) | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | # add a time stamp to version...
 | 
					
						
							|  |  |  | .PHONY: test-electron-dist | 
					
						
							| 
									
										
										
										
											2018-01-20 03:55:28 +03:00
										 |  |  | test-electron-dist: VERSION := $(VERSION)-$(DATE)-el | 
					
						
							|  |  |  | test-electron-dist: DIST := $(DIST_DIR)/$(APP_NAME)-$(VERSION)-$(TARGET_OS)-$(ARCH).zip | 
					
						
							|  |  |  | test-electron-dist: $$(DIST) | 
					
						
							|  |  |  | #test-electron-dist: $(DIST_DIR)/$(APP_NAME)-$$(VERSION)-$(TARGET_OS)-$(ARCH).zip
 | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-16 01:13:45 +03:00
										 |  |  | # NOTE: the "/" at the end here is significant...
 | 
					
						
							|  |  |  | .PHONY: electron-unpacked | 
					
						
							| 
									
										
										
										
											2018-01-20 03:55:28 +03:00
										 |  |  | electron-unpacked: VERSION := $(VERSION)-el | 
					
						
							|  |  |  | electron-unpacked: $(BUILD_DIR)/$(APP_NAME)-$$(VERSION)-$(TARGET_OS)-$(ARCH)/ | 
					
						
							| 
									
										
										
										
											2018-01-16 01:13:45 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-20 03:55:28 +03:00
										 |  |  | #.PHONY: electron-inst
 | 
					
						
							| 
									
										
										
										
											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-20 03:55:28 +03:00
										 |  |  | .PHONY: web | 
					
						
							|  |  |  | web: $(DIST_DIR)/$(APP_NAME)-$(VERSION)-web.zip | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | .PHONY: dist | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | dist: test-electron-dist | 
					
						
							|  |  |  | #dist: electron-dist
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-20 03:55:28 +03:00
										 |  |  | # NOTE: with the default sort order this gets the "latest" file, not sure
 | 
					
						
							|  |  |  | # 	how portable this is...
 | 
					
						
							|  |  |  | # XXX when ./dist is empty or non existent this will deploy the second arg...
 | 
					
						
							|  |  |  | # XXX HACK-ish...
 | 
					
						
							|  |  |  | # 	- deploy only when scrip both the script AND target are available
 | 
					
						
							|  |  |  | .PHONY: deploy | 
					
						
							|  |  |  | deploy: $(wildcard $(DIST_DIR)/$(APP_NAME)-*.zip) $(wildcard scripts/deploy.sh) | 
					
						
							|  |  |  | 	@[ -e $(DIST_DIR)/$(APP_NAME)-*.zip ] \
 | 
					
						
							|  |  |  | 		|| echo "Deploy error: Nothing to deploy, skipping." | 
					
						
							|  |  |  | 	@[ -e ./scripts/deploy.sh ] \
 | 
					
						
							|  |  |  | 		&& bash ./scripts/deploy.sh "$(DIST_DIR)/$(APP_NAME)-*.zip" \
 | 
					
						
							|  |  |  | 		|| echo "Deploy error: No deploy.sh script found in ./scripts/, skipping." | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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-15 08:20:05 +03:00
										 |  |  | PACK_MINIMAL = $(BUILD_DIR)/$(APP_NAME)/ $(NODE_MODULES_MINIMAL) | 
					
						
							|  |  |  | PACK_FULL = $(BUILD_DIR)/$(APP_NAME)/ $(BUILD_DIR)/$(APP_NAME)/$(NODE_DIR) | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-09 02:27:54 +03:00
										 |  |  | # build date...
 | 
					
						
							| 
									
										
										
										
											2018-01-13 05:19:45 +03:00
										 |  |  | # NOTE: this depends on lots of stuff so as to be updated in case any of
 | 
					
						
							|  |  |  | # 	the dependencies are touched...
 | 
					
						
							| 
									
										
										
										
											2018-01-12 21:59:08 +03:00
										 |  |  | $(BUILD_INFO): $(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-13 05:19:45 +03:00
										 |  |  | 	@echo "Build info:" | 
					
						
							|  |  |  | 	@echo "$(APP_NAME)" | tee $(BUILD_INFO) | 
					
						
							|  |  |  | 	@echo "$(VERSION)" | tee -a $(BUILD_INFO) | 
					
						
							|  |  |  | 	@echo "$(DATE)" | tee -a $(BUILD_INFO) | 
					
						
							|  |  |  | 	@echo "$(COMMIT)" | tee -a $(BUILD_INFO) | 
					
						
							| 
									
										
										
										
											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-13 01:59:52 +03:00
										 |  |  | # XXX might be a good idea to install directly to $(BUILD_DIR) so as not 
 | 
					
						
							|  |  |  | # 	to messup the current dir...
 | 
					
						
							| 
									
										
										
										
											2018-01-08 07:29:33 +03:00
										 |  |  | # XXX need to make this arch/os specific for cross compiling...
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | # XXX requirejs breaks here for some reason, breaking npm install and 
 | 
					
						
							|  |  |  | # 	the build...
 | 
					
						
							|  |  |  | #%/$(NODE_DIR): package.json
 | 
					
						
							|  |  |  | #	$(MD) "$@"
 | 
					
						
							|  |  |  | #	cp package*.json "$(@D)"
 | 
					
						
							| 
									
										
										
										
											2018-01-13 05:19:45 +03:00
										 |  |  | #	cd "$*" ; \
 | 
					
						
							|  |  |  | #		npm install ; \
 | 
					
						
							|  |  |  | #		electron-rebuild
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | #	@touch "$@"
 | 
					
						
							| 
									
										
										
										
											2018-01-13 05:19:45 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #$(NODE_DIR):
 | 
					
						
							|  |  |  | $(NODE_DIR): package.json | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | 	npm install | 
					
						
							| 
									
										
										
										
											2018-01-09 23:26:00 +03:00
										 |  |  | 	electron-rebuild | 
					
						
							| 
									
										
										
										
											2018-01-20 03:55:28 +03:00
										 |  |  | 	@touch "$@" | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-08 05:42:12 +03:00
										 |  |  | # build app dir...
 | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME)/: $(PROJECT_FILES) \ | 
					
						
							| 
									
										
										
										
											2018-01-08 08:23:02 +03:00
										 |  |  | 		$(JS_FILES) $(CSS_FILES) $(HTML_FILES) \
 | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | 		$(wildcard $(FEATURES_DIR)/*.js) \
 | 
					
						
							|  |  |  | 		$(wildcard $(LIB_DIR)/*.js) $(wildcard $(LIB_DIR)/widget/*.js) \
 | 
					
						
							|  |  |  | 		$(wildcard $(DOMAIN_DIR)/*.js) \
 | 
					
						
							| 
									
										
										
										
											2018-01-12 21:59:08 +03:00
										 |  |  | 		$(BUILD_INFO) | 
					
						
							| 
									
										
										
										
											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-12 21:59:08 +03:00
										 |  |  | 		$(BUILD_INFO) \
 | 
					
						
							| 
									
										
										
										
											2018-01-08 06:39:10 +03:00
										 |  |  | 		"$(BUILD_DIR)/$(APP_NAME)" | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | 	# cleanup vim swap files... | 
					
						
							| 
									
										
										
										
											2018-01-20 03:55:28 +03:00
										 |  |  | 	# NOTE: we need to do this as we copy whole directories... | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | 	cd "$@" ; \
 | 
					
						
							|  |  |  | 		find . -name *.sw[po] -delete | 
					
						
							| 
									
										
										
										
											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...
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | # XXX %/$(NODE_DIR): $(NODE_DIR) ???
 | 
					
						
							| 
									
										
										
										
											2018-01-11 18:31:48 +03:00
										 |  |  | $(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...
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | # NOTE: these intersect, so one should remove the previos before making 
 | 
					
						
							|  |  |  | # 	a new app dir...
 | 
					
						
							| 
									
										
										
										
											2018-01-11 19:58:24 +03:00
										 |  |  | .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),..)) | 
					
						
							| 
									
										
										
										
											2018-01-15 08:20:05 +03:00
										 |  |  | zipfrom = cd $1 ; \
 | 
					
						
							|  |  |  | 	  zip -r "$(call up,$1)/$2" $3 | 
					
						
							|  |  |  | zipdelfrom = cd $1 ; \
 | 
					
						
							|  |  |  | 	     zip -d "$(call up,$1)/$2" $3 | 
					
						
							| 
									
										
										
										
											2018-01-11 06:55:54 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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 \
 | 
					
						
							| 
									
										
										
										
											2018-01-20 01:14:59 +03:00
										 |  |  | 			--exclude-hidden \
 | 
					
						
							| 
									
										
										
										
											2018-01-11 04:04:22 +03:00
										 |  |  | 			--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-12 21:59:08 +03:00
										 |  |  | .PRECIOUS: $(TARGET_DIR)/$(ELECTRON_DIST) | 
					
						
							|  |  |  | $(TARGET_DIR)/$(ELECTRON_DIST): | 
					
						
							| 
									
										
										
										
											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-14 22:23:51 +03:00
										 |  |  | # NOTE: the "/" here is significant -- it prevents conflicts with other 
 | 
					
						
							|  |  |  | # 	rules...
 | 
					
						
							| 
									
										
										
										
											2018-01-12 05:56:34 +03:00
										 |  |  | # XXX need to setup app icons...
 | 
					
						
							| 
									
										
										
										
											2018-01-12 21:59:08 +03:00
										 |  |  | .PRECIOUS: $(BUILD_DIR)/$(APP_NAME)-%/ | 
					
						
							|  |  |  | $(BUILD_DIR)/$(APP_NAME)-%/: $(TARGET_DIR)/$(ELECTRON_DIST) \ | 
					
						
							|  |  |  | 		$(BUILD_DIR)/app.asar $(BUILD_INFO) | 
					
						
							| 
									
										
										
										
											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-12 21:59:08 +03:00
										 |  |  | 	cp -f "$(BUILD_INFO)" "$@/" | 
					
						
							| 
									
										
										
										
											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-13 01:59:52 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME)-%.in-place.zip: $(TARGET_DIR)/$(ELECTRON_DIST) \ | 
					
						
							| 
									
										
										
										
											2018-01-12 21:59:08 +03:00
										 |  |  | 		$(BUILD_DIR)/app.asar $(BUILD_INFO) | 
					
						
							| 
									
										
										
										
											2018-01-10 22:54:55 +03:00
										 |  |  | 	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-12 21:59:08 +03:00
										 |  |  | 	$(call zipfrom,"$(BUILD_DIR)",$@.tmp,"$(ASAR_PATH)" "$(notdir $(BUILD_INFO))") | 
					
						
							| 
									
										
										
										
											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 21:59:08 +03:00
										 |  |  | $(BUILD_DIR)/$(APP_NAME)-%.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
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | # Desktop installer (WiX)...
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | #----------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2018-01-17 03:09:22 +03:00
										 |  |  | # deb/rpm package...
 | 
					
						
							| 
									
										
										
										
											2018-01-14 22:23:51 +03:00
										 |  |  | # XXX
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2018-01-17 03:09:22 +03:00
										 |  |  | # Mobile (cordova/PhoneGap)... 
 | 
					
						
							|  |  |  | # XXX
 | 
					
						
							| 
									
										
										
										
											2018-01-11 03:06:27 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-20 02:25:36 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #**********************************************************************
 | 
					
						
							| 
									
										
										
										
											2018-01-11 02:03:39 +03:00
										 |  |  | #						       vim:set nowrap :
 |