aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2021-03-07 18:24:12 +0100
committerTeddy Wing2021-03-07 18:24:12 +0100
commit8f09695671d5678262a9a778ca64db21ac9620ed (patch)
tree884483a3dfec4915a4aa62c4b160d54676cf2805
parentf326ee4851490204c0aba2692659db2ecf63510d (diff)
downloadRe-Good-Catalina-Invert-Colours-8f09695671d5678262a9a778ca64db21ac9620ed.tar.bz2
Makefile: Add rules to build a distribution tarballv0.0.1
-rw-r--r--.gitignore1
-rw-r--r--Makefile35
2 files changed, 35 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 84c048a..e2cae22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/build/
+/dist/
diff --git a/Makefile b/Makefile
index e5b5830..5161617 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,12 @@ BUILD_DIR := $(abspath build)
LOCAL_INCLUDE_DIR := $(BUILD_DIR)/include
RELEASE_PRODUCT := invert-catalina-invert
+LAUNCHD_PLIST := Library/LaunchAgents/com.teddywing.invert-catalina-invert.plist
+VERSION := $(shell awk -F '"' '/static const char \*VERSION/ { print $$2 }' main.m)
+
+DIST := $(abspath dist)
+DIST_PRODUCT := $(DIST)/bin/$(RELEASE_PRODUCT)
+DIST_LAUNCHD_PLIST := $(DIST)/$(LAUNCHD_PLIST)
.PHONY: all
@@ -72,4 +78,31 @@ $(LOCAL_INCLUDE_DIR): | $(BUILD_DIR)
clean:
rm -rf $(RELEASE_PRODUCT) \
$(BUILD_DIR) \
- $(DDHOTKEY_OBJ)
+ $(DDHOTKEY_OBJ) \
+ $(DIST)
+
+
+.PHONY: dist
+dist: $(DIST_PRODUCT) $(DIST_LAUNCHD_PLIST)
+
+$(DIST):
+ mkdir -p $@
+
+$(DIST)/bin: | $(DIST)
+ mkdir -p $@
+
+$(DIST)/Library/LaunchAgents: | $(DIST)
+ mkdir -p $@
+
+$(DIST_PRODUCT): $(DIST)/bin $(RELEASE_PRODUCT)
+ cp $(RELEASE_PRODUCT) $<
+
+$(DIST_LAUNCHD_PLIST): $(DIST)/Library/LaunchAgents $(LAUNCHD_PLIST)
+ cp $(LAUNCHD_PLIST) $<
+
+
+.PHONY: pkg
+pkg: invert-catalina-invert_$(VERSION)_x86_64.tar.bz2
+
+invert-catalina-invert_$(VERSION)_x86_64.tar.bz2: dist
+ tar cjv -s /dist/invert-catalina-invert_$(VERSION)_x86_64/ -f $@ dist