tweaking the makefile...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-01-09 02:27:54 +03:00
parent 5ce232875e
commit 5ec5075caf
2 changed files with 27 additions and 20 deletions

View File

@ -22,42 +22,48 @@
# - installers: # - installers:
# - msi # - msi
# - deb # - deb
# - cross-compiling support...
# #
# #
# #
#********************************************************************** #**********************************************************************
# variables...
APP_NAME=ImageGrid.Viewer APP_NAME=ImageGrid.Viewer
ELECTRON_DOWNOAD_URL=https://github.com/electron/electron/releases/download # Electron stuff...
# XXX Linux does not let an app run if some of the libs it is linked # XXX Linux does not let an app run if some of the libs it is linked
# against are missing, this can happen if we try to run electron # against are missing, this can happen if we try to run electron
# on a non-GUI box... # on a non-GUI box...
# ...love the "staticly" linked "dynamic" libs... # ...love the "statically" linked "dynamic" libs...
#ELECTRON_VERSION=v1.8.1 ELECTRON_VERSION = $(strip $(shell electron -v))
ELECTRON_VERSION=$(strip $(shell electron -v)) ELECTRON_VERSION ?= v1.8.1
NODE_VERSION=`node --version` ELECTRON_DOWNOAD_URL = https://github.com/electron/electron/releases/download
# OS-specific stuff... # OS-specific stuff...
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
EXT=.exe EXT = .exe
DLLs="$@/"*dll DLLs = "$@/"*dll
TARGET_OS=win32 TARGET_OS = win32
else else
ifeq ($(shell uname -s),Linux) ifeq ($(shell uname -s),Linux)
TARGET_OS=linux TARGET_OS = linux
endif endif
ifeq ($(shell uname -s),Darwin) ifeq ($(shell uname -s),Darwin)
TARGET_OS=darwin TARGET_OS = darwin
endif endif
endif endif
#----------------------------------------------------------------------
# Built-in make stuff...
RM += -f
#********************************************************************** #**********************************************************************
@ -87,6 +93,7 @@ APP_DATE=$(BUILD_DIR)/DATE
#********************************************************************** #**********************************************************************
# User targets...
all: dev all: dev
@ -99,11 +106,11 @@ css: $(CSS_FILES)
dev: $(NODE_DIR) css dev: $(NODE_DIR) css
clean: clean:
rm -rf $(BUILD_DIR) $(RM) $(BUILD_DIR)
# XXX for some reason this is called on make win64e... # XXX for some reason this is called on make win64e...
cleanall: clean cleanall: clean
rm -rf $(DIST_DIR) $(TARGET_DIR) $(RM) $(DIST_DIR) $(TARGET_DIR)
electron-dist-x64: $(DIST_DIR)/$(APP_NAME)-$(TARGET_OS)-x64.zip electron-dist-x64: $(DIST_DIR)/$(APP_NAME)-$(TARGET_OS)-x64.zip
@ -118,10 +125,10 @@ dist: electron-dist-x64
#********************************************************************** #**********************************************************************
# build targets... # build rules...
# build info... # build date...
# XXX add build version... # XXX add build version...
$(APP_DATE): $(CSS_FILES) $(NODE_DIR) $(PROJECT_FILES) \ $(APP_DATE): $(CSS_FILES) $(NODE_DIR) $(PROJECT_FILES) \
$(JS_FILES) $(CSS_FILES) $(HTML_FILES) $(JS_FILES) $(CSS_FILES) $(HTML_FILES)
@ -176,9 +183,6 @@ $(TARGET_DIR)/electron-$(ELECTRON_VERSION)-%.zip:
-O "$@" -O "$@"
# XXX nwjs... (???)
# build the app dir... # build the app dir...
# XXX this is electron-specific... # XXX this is electron-specific...
.PRECIOUS: $(BUILD_DIR)/$(APP_NAME)-% .PRECIOUS: $(BUILD_DIR)/$(APP_NAME)-%
@ -187,7 +191,7 @@ $(BUILD_DIR)/$(APP_NAME)-%: $(TARGET_DIR)/electron-$(ELECTRON_VERSION)-%.zip \
unzip -u "$<" -d "$@" unzip -u "$<" -d "$@"
cp "$(BUILD_DIR)/app.asar" "$@/resources/" cp "$(BUILD_DIR)/app.asar" "$@/resources/"
cp -f "$(APP_DATE)" "$@/" cp -f "$(APP_DATE)" "$@/"
rm -f "$@/resources/default_app.asar" $(RM) "$@/resources/default_app.asar"
mv "$@/electron$(EXT)" "$@/$(APP_NAME)$(EXT)" mv "$@/electron$(EXT)" "$@/$(APP_NAME)$(EXT)"
chmod +x "$@/$(APP_NAME)$(EXT)" $(DLLs) chmod +x "$@/$(APP_NAME)$(EXT)" $(DLLs)
touch "$@" touch "$@"
@ -200,6 +204,8 @@ $(DIST_DIR)/$(APP_NAME)-%.zip: $(BUILD_DIR)/$(APP_NAME)-%
zip -r "../$@" "$(APP_NAME)-$*" zip -r "../$@" "$(APP_NAME)-$*"
# XXX nwjs... (???)
# installer (WiX)... # installer (WiX)...
# XXX add to path... # XXX add to path...

View File

@ -48,6 +48,7 @@
}, },
"scripts": { "scripts": {
"build-css": "lessc css/layout.less css/layout.css", "build-css": "lessc css/layout.less css/layout.css",
"build-dist": "make dist",
"start": "electron e.js" "start": "electron e.js"
} }
} }