summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorNicolas Paul <n@nc0.fr>2023-04-25 17:39:02 +0200
committerNicolas Paul <n@nc0.fr>2023-04-25 17:39:02 +0200
commit1ab9ba20b482271d27456d6d52c124991278a299 (patch)
treedc8f8af8ca94b31b9e9e6cd95e86fd709c95f52b /Makefile
parent12d086bf4a0dc9422ccbb3ef7b38625e4cc98d89 (diff)
Add Makefile
Allows inserting build information variables at compile time
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 18 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..206bf7c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,18 @@
+# Copyright (c) 2023 Nicolas Paul All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+BINARY := crocc
+
+VERSION := $(shell git describe --tags --always --dirty)
+DATE := $(shell date -u '+%FT%T%z')
+
+LDFLAGS := -ldflags "-w -s -X main.version=$(VERSION) -X main.date=$(DATE)"
+
+$(BINARY): *.go
+ go build $(LDFLAGS) -o $(BINARY)
+
+clean:
+ rm -f $(BINARY)
+
+.PHONY: clean