bedrocktool/Makefile

44 lines
734 B
Makefile
Raw Normal View History

2022-02-12 22:27:49 +00:00
GC = go build -ldflags "-s -w"
2022-08-12 17:55:51 +00:00
TAG = $(shell git describe --tags)
2022-08-11 20:22:39 +00:00
2022-08-14 14:12:33 +00:00
NAME = bedrocktool-${TAG}
2022-02-12 22:27:49 +00:00
SRCS = $(wildcard *.go)
2022-08-12 17:55:51 +00:00
HAVE_PACKS = false
ifeq ($(shell head -c 7 resourcepack-ace.go),package)
HAVE_PACKS = true
endif
$(info pack support: ${HAVE_PACKS})
ifneq ($(HAVE_PACKS),true)
GC += -overlay overlay.json
endif
2022-08-14 14:12:33 +00:00
BUILDS=\
windows_amd64.exe\
windows_arm64.exe\
darwin_amd64\
darwin_arm64\
linux_amd64\
linux_arm64
2022-08-12 17:55:51 +00:00
2022-02-12 22:27:49 +00:00
2022-08-14 14:12:33 +00:00
DISTS=$(BUILDS:%=$(NAME)_%)
2022-08-11 20:22:39 +00:00
2022-08-14 14:12:33 +00:00
all: $(DISTS)
2022-08-11 20:22:39 +00:00
2022-08-14 14:12:33 +00:00
.PHONY: all clean $(DISTS)
2022-02-12 22:27:49 +00:00
2022-08-14 14:12:33 +00:00
$(DISTS): OS = $(word 2,$(subst _, ,$@))
$(DISTS): ARCH = $(word 1,$(subst ., ,$(word 3,$(subst _, ,$@))))
2022-02-12 22:27:49 +00:00
2022-08-14 14:12:33 +00:00
$(DISTS): $(SRCS)
@echo "building: $@"
GOOS=$(OS) GOARCH=$(ARCH) $(GC) -o $@
2022-02-12 22:27:49 +00:00
clean:
rm $(NAME).exe $(NAME)-linux $(NAME)-mac