summaryrefslogtreecommitdiff
path: root/Makefile
blob: a0af4eca0fa54c5e35a05e543754c20ba6d204ab (plain)
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
#colors
RED=\033[0;31m
GREEN=\033[0;32m
NC=\033[0m # No Color
MAGENTA=\033[0;35m
YELLOW=\033[0;33m

#PROGRAM NAME
PROG1 = setup.py
PROG2 = main.py
SRC = $(wildcard *.py)
SPEC = .spec
DIR = $(shell pwd)
FILES = build *.spec

#COMPILER variable
CC = pyinstaller
CFLAGS = --clean --noconfirm --noconsole --uac-admin -F


#rules and recipes
all: buildmac zipmacapp cleanspec

cleanspec:
	@printf "$(YELLOW)Cleaning spec...$(NC)\n"
	@rm -rf $(FILES)
	@if [ $$? -eq 0 ]; then printf "$(MAGENTA)Files $(FILES) are removed successfully\n"; else printf "$(RED)Error: Files $(FILES) are not removed\n"; fi

buildmac:
	@rm -f dist/$(PROG1) dist/$(PROG1).app dist/$(PROG1) dist/$(PROG2).app
	@printf "$(YELLOW)In porcess ... to compile the $(GREEN)$(PROG1)${NC}\n"
	$(CC) $(CFLAGS) $(PROG1)
	@printf "$(YELLOW)In porcess ... to compile the $(GREEN)$(PROG2)${NC}\n"
	$(CC) $(CFLAGS) $(PROG2)
	@printf "$(YELLOW)$(PROG1) $(PROG2)$(GREEN) compiled successfully${NC}\n"
	@mv dist/setup dist/setup-mac
	@mv dist/main dist/main-mac

buildlinux:
	@rm -f dist/$(PROG1) dist/$(PROG1).app dist/$(PROG1) dist/$(PROG2).app
	@printf "$(YELLOW)In porcess ... to compile the $(GREEN)$(PROG1)${NC}\n"
	$(CC) $(CFLAGS) $(PROG1)
	@printf "$(YELLOW)In porcess ... to compile the $(GREEN)$(PROG2)${NC}\n"
	$(CC) $(CFLAGS) $(PROG2)
	@printf "$(YELLOW)$(PROG1) $(PROG2)$(GREEN) compiled successfully${NC}\n"
	@mv dist/setup dist/setup-linux
	@mv dist/main dist/main-linux

run: build*
	@open ./dist/*

zipmacapp: buildmac
	@zip -r dist/setup.app.zip dist/setup.app
	@zip -r dist/main.app.zip dist/main.app
	@if [ $$? -eq 0 ]; then printf "$(MAGENTA)Files dist(*.app) are zipped successfully\n"; else printf "$(RED)Error: Files dist(*.app) are not zipped\n"; fi

clean: cleanspec
	@printf "$(YELLOW)Cleaning...$(NC)\n"
	@rm -rf dist
	@if [ $$? -eq 0 ]; then printf "$(MAGENTA)Files dist(*) are removed successfully\n"; else printf "$(RED)Error: Files dist(*) are not removed\n"; fi