forked from alexandregv/RP42
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (49 loc) · 1.66 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
NAME = RP42
# Compiler & Preprocessor flags
LDFLAGS +=
MAKEFLAGS += --no-print-directory
# Colors
C_RESET = \033[0m
C_PENDING = \033[0;36m
C_SUCCESS = \033[0;32m
# Escape Sequences (ANSI/VT100)
ES_ERASE = "\033[A\033[K\033[A"
ERASE = $(ECHO) $(ES_ERASE)
# Hide STD/ERR and prevent Make from returning non-zero code
HIDE_STD = > /dev/null
HIDE_ERR = 2> /dev/null || true
# Cross platforms
ECHO = echo
ifeq ($(shell uname),Linux)
ECHO += -e
endif
all: $(NAME)
$(NAME): linux windows macos
@$(ECHO) "$(C_SUCCESS)Compilation successful! 👌 (./build/)$(C_RESET)"
linux:
@$(ECHO) "Linux\t[$(C_PENDING)⏳ $(C_RESET)]"
@GOOS=linux GOARCH=amd64 go build -o build/linux/$(NAME) -ldflags "$(LDFLAGS)" -tags legacy_appindicator cmd/$(NAME)/main.go
@$(ERASE)
@$(ECHO) "Linux\t[$(C_SUCCESS)✅ $(C_RESET)]"
windows:
@$(ECHO) "Windows\t[$(C_PENDING)⏳ $(C_RESET)]"
@GOOS=windows GOARCH=amd64 go build -o build/windows/$(NAME).exe -ldflags "-H=windowsgui $(LDFLAGS)" cmd/$(NAME)/main.go
@$(ERASE)
@$(ECHO) "Windows\t[$(C_SUCCESS)✅ $(C_RESET)]"
macos:
@$(ECHO) "MacOS\t[$(C_PENDING)⏳ $(C_RESET)]"
@env GOOS=darwin GOARCH=amd64 go build -o build/macOS/$(NAME) -ldflags "$(LDFLAGS)" cmd/$(NAME)/main.go
@cp -R assets/macOS/ build/macOS/
@cp build/macOS/$(NAME) build/macOS/$(NAME).app/Contents/MacOS/RP42
@rm build/macOS/$(NAME).app/Contents/MacOS/.gitkeep
@$(ERASE)
@$(ECHO) "MacOS\t[$(C_SUCCESS)✅ $(C_RESET)]"
deploy:
@cp build/macOS/RP42 /sgoinfre/goinfre/Perso/aguiot--/public/RP42
@cp -R build/macOS/RP42.app /sgoinfre/goinfre/Perso/aguiot--/public
clean:
@#$(RM) -r build/ $(HIDE_ERR)
fclean: clean
@$(RM) -rf build/
re: fclean all
.PHONY: clean fclean all re