Repository navigation
Expand file tree
/
Copy pathmakefile
More file actions
90 lines (71 loc) · 1.86 KB
/
Copy pathmakefile
File metadata and controls
90 lines (71 loc) · 1.86 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Compiler and flags
CC = gcc
CFLAGS = -I$(INCLUDE_DIR) -Wall -mwindows
# Resource compiler
RC = windres
# Libraries
LIBS = -luser32 -lshell32 -lgdi32
# Directories
SRC_DIR = ./src
ASSETS_DIR = $(SRC_DIR)/assets
ANIMATION_DIR = $(ASSETS_DIR)/frames
INCLUDE_DIR = $(SRC_DIR)/include
INSTALLER_DIR = ./install
RELEASE_DIR = ./release
RELEASE_DIR_SRC = $(RELEASE_DIR)/src
OUT_DIR = ./out
# Source files
SRCS = $(SRC_DIR)/systray.c
SRCS += $(wildcard $(INCLUDE_DIR)/*.c)
# Resource file
RES = $(INCLUDE_DIR)/resource.rc
# Output binary
TARGET = WallCycle.exe
# Object files
OBJS = $(SRCS:%.c=$(OUT_DIR)/%.o)
RES_OBJ = $(OUT_DIR)/resource.o
# Installer
CI = ISCC.exe
ISRCS = $(INSTALLER_DIR)/installer.iss
# Default rule
all: $(TARGET)
# Compile and link
$(TARGET): $(OBJS) $(RES_OBJ)
$(CC) $(OBJS) $(RES_OBJ) $(CFLAGS) $(LIBS) -o $(TARGET)
# Compile source files
$(OUT_DIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) -c $< $(CFLAGS) -o $@
# Compile resource file
$(RES_OBJ): $(RES)
@mkdir -p $(OUT_DIR)
$(RC) -i $< -o $@
# Clean up build artifacts
clean:
rm -rf $(OUT_DIR) $(TARGET)
# Create installer
installer:
$(CI) $(ISRCS)
# Copy release files
copy:
@mkdir -p $(RELEASE_DIR_SRC)/img
cp ./WallCycle.exe $(RELEASE_DIR_SRC)
cp ./config.ini $(RELEASE_DIR_SRC)
cp ./README.md $(RELEASE_DIR_SRC)
cp -r ./img/* $(RELEASE_DIR_SRC)/img/
# Release task
release: animation all copy installer
# Clean release output
release-clean: clean animation-clean
rm -rf $(RELEASE_DIR)
# Generate animation icons and resources
animation:
source ./.venv/Scripts/activate && \
python ./tooling/pngToIco.py -c "#1E1E1E" -f $(ANIMATION_DIR) && \
mv $(ANIMATION_DIR)/resource.h $(INCLUDE_DIR)/resource.h && \
mv $(ANIMATION_DIR)/resource.rc $(INCLUDE_DIR)/resource.rc
# Clean animation icons
animation-clean:
rm -f $(ANIMATION_DIR)/*.ico
rm -f $(INCLUDE_DIR)/resource.h
rm -f $(INCLUDE_DIR)/resource.rc