-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
73 lines (54 loc) · 1.73 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
# Makefile
.PHONY: help release checks version phony update-files pr clean
# Helper to source .env and get variables
GET_VAR = ./scripts/get_env_var.sh
# Define variables by sourcing .env
BASE_NAME := $(shell $(GET_VAR) BASE_NAME)
BUILD_DIR := $(shell $(GET_VAR) BUILD_DIR)
MANIFEST_JSON= $(shell $(GET_VAR) MANIFEST_JSON)
UPDATE_JSON_FILE := $(shell $(GET_VAR) UPDATE_JSON_FILE)
UPDATE_RDF_FILE := $(shell $(GET_VAR) UPDATE_RDF_FILE)
# Function to get version from manifest.json
define get_version
$(shell jq -r '.version' src/manifest.json)
endef
# Get initial version
VERSION := $(call get_version)
XPI_FILE := $(BUILD_DIR)/$(BASE_NAME)-$(VERSION).xpi
# Export environment variables to make them available in scripts
export XPI_FILE
export VERSION
#########################
# Build targets
#########################
# Default Target
.DEFAULT_GOAL := help
# Define dependencies
release:
./scripts/release.sh $(BASE_NAME) $(call get_version)
pr: update-files
./scripts/manage_pr.sh
update-files: build
./scripts/update_files.sh
cp $(UPDATE_JSON_FILE) $(UPDATE_RDF_FILE)
build: $(BUILD_DIR)/$(BASE_NAME)-$(call get_version).xpi
# Build target, depends on manifest.json and source files
$(BUILD_DIR)/$(BASE_NAME)-$(call get_version).xpi: $(wildcard src/*) $(MANIFEST_JSON)
./scripts/build.sh $(BASE_NAME) $(call get_version)
version: $(MANIFEST_JSON)
$(MANIFEST_JSON): checks
./scripts/manage_version.sh
$(eval VERSION := $(call get_version))
$(eval export VERSION)
checks:
./scripts/check_changes.sh
./scripts/check_tools.sh
clean:
rm -f $(BUILD_DIR)/*.xpi
help:
@echo "No target specified."
@echo "Usage:"
@echo " help - Show help"
@echo " pr - PR workflow"
@echo " release - Release workflow"
@echo " clean - Cleanup"