-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (48 loc) · 1.79 KB
/
Copy pathMakefile
File metadata and controls
62 lines (48 loc) · 1.79 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
# APIMonitor Makefile
# Cross-compile for Windows using MinGW-w64
CC = x86_64-w64-mingw32-gcc
WINDRES = x86_64-w64-mingw32-windres
TARGET = APIMonitor.exe
SOURCES = main.c
RESOURCES = resources.rc
RELEASE_DIR = release
OBJ = main.o resources.o
# Icon sizes for system tray (16=100% DPI, 24=150%, 32=200%, 48=large, 256=hi-res)
ICON_SIZES = 16 24 32 48 256
CFLAGS = -O2 -mwindows -I.
LDFLAGS = -mwindows
LIBS = -lwinhttp -lshell32 -luser32 -lgdi32 -ladvapi32 -lcomctl32 -lole32
.PHONY: all clean icons assets
all: $(RELEASE_DIR)/$(TARGET)
$(RELEASE_DIR)/$(TARGET): $(OBJ)
@echo "Linking executable..."
@mkdir -p $(RELEASE_DIR)
$(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
@rm -f $(OBJ)
@echo "Build complete: $(RELEASE_DIR)/$(TARGET)"
main.o: $(SOURCES) resource.h
@echo "Compiling $(SOURCES)..."
$(CC) -c $< -o $@ $(CFLAGS)
resources.o: $(RESOURCES) resource.h assets/empty.ico assets/success.ico assets/fail.ico assets/blank.ico assets/dist/index.html assets/WebView2Loader.dll
@echo "Compiling resources..."
$(WINDRES) $< -o $@
assets/dist/index.html: assets/package.json assets/src/App.tsx assets/src/ConfigView.tsx assets/src/HistoryView.tsx assets/src/lib/bridge.ts
@echo "Building frontend assets..."
cd assets && npm install && npm run build
assets: assets/dist/index.html
# Generate multi-sized .ico files from .svg sources using ImageMagick
icons:
@for svg in assets/*.svg; do \
if [ -f "$$svg" ]; then \
ico=assets/$$(basename "$$svg" .svg).ico; \
echo "Generating $$ico from $$svg..."; \
convert -background transparent "$$svg" \
$(foreach size,$(ICON_SIZES),\( -clone 0 -resize $(size)x$(size) \)) \
-delete 0 -alpha on "$$ico"; \
echo "Created $$ico with sizes: $(ICON_SIZES)"; \
fi \
done
clean:
rm -f $(OBJ)
rm -rf $(RELEASE_DIR)
rm -rf assets/dist assets/node_modules