-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
29 lines (24 loc) · 1.22 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
UNAME_S := $(shell uname -s | tr 'A-Z' 'a-z')
PROJ_NAME := convert-to-quicken-csv
BIN_DIR := bin/
build: build-$(UNAME_S)
all: build-windows build-linux build-darwin docs
clean:
@rm -Rf bin
build-%:
@echo Building for $(*)
@echo GOOS=$(*) GOARCH=amd64 go build -o $(BIN_DIR)$(PROJ_NAME)-$(*)-amd64$(SUFFIX) $(PROJ_NAME).go && \
GOOS=$(*) GOARCH=amd64 go build -o $(BIN_DIR)$(PROJ_NAME)-$(*)-amd64$(SUFFIX) $(PROJ_NAME).go;
@if [ "$(*)" == "darwin" ]; then \
echo GOOS=$(*) GOARCH=arm64 go build -o $(BIN_DIR)$(PROJ_NAME)-$(*)-arm64$(SUFFIX) $(PROJ_NAME).go && \
GOOS=$(*) GOARCH=arm64 go build -o $(BIN_DIR)$(PROJ_NAME)-$(*)-arm64$(SUFFIX) $(PROJ_NAME).go && \
echo lipo -create -output $(BIN_DIR)$(PROJ_NAME)-$(*)-universal$(SUFFIX) $(BIN_DIR)$(PROJ_NAME)-$(*)-arm64$(SUFFIX) $(BIN_DIR)$(PROJ_NAME)-$(*)-amd64$(SUFFIX) && \
lipo -create -output $(BIN_DIR)$(PROJ_NAME)-$(*)-universal$(SUFFIX) $(BIN_DIR)$(PROJ_NAME)-$(*)-arm64$(SUFFIX) $(BIN_DIR)$(PROJ_NAME)-$(*)-amd64$(SUFFIX) && \
rm -f $(BIN_DIR)$(PROJ_NAME)-$(*)-amd64$(SUFFIX) && \
rm -f $(BIN_DIR)$(PROJ_NAME)-$(*)-arm64$(SUFFIX); \
fi
docs:
ifeq (, $(shell which doctoc))
$(error "No doctoc in $(PATH), consider installing to run 'docs' target")
endif
@doctoc README.md