-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.release
More file actions
30 lines (25 loc) · 882 Bytes
/
Makefile.release
File metadata and controls
30 lines (25 loc) · 882 Bytes
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
#############
# Constants #
#############
PROGRAM_NAME = netbox-extractor
SOURCE_FILE = src/$(PROGRAM_NAME).cr
OUTPUT_FILE = bin/$(PROGRAM_NAME)-${TARGETOS}-${TARGETARCH}
COMPILE_OPTS = --threads 4 --release --error-trace --static
COMPRESSED_FILE = $(OUTPUT_FILE)-upx
#########
# Tasks #
#########
debug: ## Display build environment config
@uname -a
@echo "TARGETPLATFORM: ${TARGETPLATFORM}"
@echo "TARGETOS: ${TARGETOS}"
@echo "TARGETARCH: ${TARGETARCH}"
@echo "TARGETVARIANT: ${TARGETVARIANT}"
@echo "SOURCE_FILE: $(SOURCE_FILE)"
@echo "OUTPUT_FILE: $(OUTPUT_FILE)"
@echo "COMPRESSED_FILE: $(COMPRESSED_FILE)"
deps: debug ## Install production dependencies
shards install --production
release: deps ## Compile to production binary (static mode)
crystal build $(COMPILE_OPTS) -o $(OUTPUT_FILE) $(SOURCE_FILE)
upx -o $(COMPRESSED_FILE) $(OUTPUT_FILE)