-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (49 loc) · 1.56 KB
/
Makefile
File metadata and controls
58 lines (49 loc) · 1.56 KB
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
APP_NAME = tilf
MAIN_SCRIPT = main.py
VENV_DIR = env
RESOURCES_DIR = assets
STYLESHEET_FILE = style.qss
PYINSTALLER_DATA_SEP = :
PYTHON = $(VENV_DIR)/bin/python
ifeq ($(shell uname), Darwin)
ICON_FILE = $(RESOURCES_DIR)/icon.icns
else
ICON_FILE = $(RESOURCES_DIR)/icon.ico
endif
.PHONY: all build clean run install
all: build
install: $(VENV_DIR)/touchfile
$(VENV_DIR)/touchfile: requirements.txt
@echo "Creating virtual environment and installing dependencies..."
test -d $(VENV_DIR) || python3 -m venv $(VENV_DIR)
$(PYTHON) -m pip install --upgrade pip
$(PYTHON) -m pip install -r requirements.txt
@touch $(VENV_DIR)/touchfile
requirements.txt:
@echo "Generating requirements.txt..."
@echo "pyside6" > requirements.txt
@echo "pyinstaller" >> requirements.txt
@echo "requirements.txt created successfully."
# pyinstaller --name tilf --onefile --windowed
# --icon assets/icon.icns --add-data assets:assets --add-data style.qss:.
# main.py
build: install
@echo "Building the application bundle..."
$(PYTHON) -m PyInstaller --name $(APP_NAME) \
--onefile \
--windowed \
--icon=$(ICON_FILE) \
--add-data "$(RESOURCES_DIR)$(PYINSTALLER_DATA_SEP)$(RESOURCES_DIR)" \
--add-data "$(STYLESHEET_FILE)$(PYINSTALLER_DATA_SEP)." \
$(MAIN_SCRIPT)
@echo "Build complete. Check the 'dist' folder."
run:
@echo "Running $(APP_NAME)..."
./dist/$(APP_NAME)
clean:
@echo "Cleaning up build files and virtual environment..."
rm -rf build dist __pycache__
rm -f $(APP_NAME).spec
rm -rf $(VENV_DIR)
rm -f requirements.txt
@echo "Cleanup complete."