forked from ajour/ajour
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (68 loc) · 2.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
TARGET = ajour
RESOURCES_DIR = resources
RELEASE_DIR = target/release
APP_NAME = Ajour.app
APP_TEMPLATE = $(RESOURCES_DIR)/osx/$(APP_NAME)
APP_DIR = $(RELEASE_DIR)/osx
APP_BINARY = $(RELEASE_DIR)/$(TARGET)
APP_BINARY_DIR = $(APP_DIR)/$(APP_NAME)/Contents/MacOS
APP_RESOURCES_DIR = $(APP_DIR)/$(APP_NAME)/Contents/Resources
APPIMAGE_NAME ?=
APPIMAGE_DIR = $(RELEASE_DIR)/AppDir
APPIMAGE_DESKTOP_FILE = $(RESOURCES_DIR)/linux/ajour.desktop
APPIMAGE_LOGO_FILE = $(RESOURCES_DIR)/logo/256x256/ajour.png
TAR_NAME = ajour.tar.gz
DMG_NAME ?=
DMG_DIR = $(RELEASE_DIR)/osx
OPENGL ?=
MACOS ?=
ifdef MACOS
ENV :=MACOSX_DEPLOYMENT_TARGET="10.11"
endif
ifdef OPENGL
DMG_NAME :=ajour-opengl.dmg
APPIMAGE_NAME :=ajour-opengl.AppImage
FEATURE_FLAG :=--no-default-features --features opengl
else
DMG_NAME :=ajour.dmg
APPIMAGE_NAME :=ajour.AppImage
FEATURE_FLAG :=
endif
vpath $(TARGET) $(RELEASE_DIR)
vpath $(APP_NAME) $(APP_DIR)
vpath $(DMG_NAME) $(APP_DIR)
binary: $(TARGET) ## Build release binary with cargo
$(TARGET):
$(ENV) cargo build --release $(FEATURE_FLAG)
tar: $(TARGET) ## Create tar.gz of the binary
cd $(RELEASE_DIR) && tar -czf $(TAR_NAME) $(TARGET)
app: $(APP_NAME) ## Clone Ajour.app template and mount binary
$(APP_NAME): $(TARGET)
@mkdir -p $(APP_BINARY_DIR)
@mkdir -p $(APP_RESOURCES_DIR)
@cp -fRp $(APP_TEMPLATE) $(APP_DIR)
@cp -fp $(APP_BINARY) $(APP_BINARY_DIR)
@touch -r "$(APP_BINARY)" "$(APP_DIR)/$(APP_NAME)"
@echo "Created '$@' in '$(APP_DIR)'"
dmg: $(DMG_NAME) ## Pack Ajour.app into .dmg
$(DMG_NAME): $(APP_NAME)
@echo "Packing disk image..."
@ln -sf /Applications $(DMG_DIR)/Applications
@hdiutil create $(DMG_DIR)/$(DMG_NAME) \
-volname "Ajour" \
-fs HFS+ \
-srcfolder $(APP_DIR) \
-ov -format UDZO
@echo "Packed '$@' in '$(APP_DIR)'"
appimage: $(APPIMAGE_NAME) ## Bundle release binary as AppImage
$(APPIMAGE_NAME): $(TARGET)
OUTPUT=$(APPIMAGE_NAME) ./linuxdeploy-x86_64.AppImage \
--appdir $(APPIMAGE_DIR) \
-e $(APP_BINARY) \
-d $(APPIMAGE_DESKTOP_FILE) \
-i $(APPIMAGE_LOGO_FILE) \
--output appimage
@rm -rf $(APPIMAGE_DIR)
.PHONY: app binary dmg appimage tar
clean: ## Remove all artifacts
-rm -rf $(APP_DIR)