-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
82 lines (64 loc) · 1.85 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
NAME := rokuyon
BUILD := build
SRCS := src src/desktop
ARGS := -O3 -flto -std=c++11 -DLOG_LEVEL=0
LIBS := $(shell pkg-config --libs portaudio-2.0)
INCS := $(shell pkg-config --cflags portaudio-2.0)
APPNAME := rokuyon
PKGNAME := com.hydra.rokuyon
DESTDIR ?= /usr
ifeq ($(OS),Windows_NT)
ARGS += -static -DWINDOWS
LIBS += $(shell wx-config-static --libs std,gl) -lole32 -lsetupapi -lwinmm
INCS += $(shell wx-config-static --cxxflags std,gl)
else
LIBS += $(shell wx-config --libs std,gl)
INCS += $(shell wx-config --cxxflags std,gl)
ifeq ($(shell uname -s),Darwin)
ARGS += -DMACOS
LIBS += -headerpad_max_install_names
else
ARGS += -no-pie
LIBS += -lGL
endif
endif
CPPFILES := $(foreach dir,$(SRCS),$(wildcard $(dir)/*.cpp))
HFILES := $(foreach dir,$(SRCS),$(wildcard $(dir)/*.h))
OFILES := $(patsubst %.cpp,$(BUILD)/%.o,$(CPPFILES))
all: $(NAME)
ifneq ($(OS),Windows_NT)
ifeq ($(uname -s),Darwin)
install: $(NAME)
./mac-bundle.sh
cp -r $(APPNAME).app /Applications/
uninstall:
rm -rf /Applications/$(APPNAME).app
else
flatpak:
flatpak-builder --repo=repo --force-clean build-flatpak $(PKGNAME).yml
flatpak build-bundle repo $(NAME).flatpak $(PKGNAME)
flatpak-clean:
rm -rf .flatpak-builder
rm -rf build-flatpak
rm -rf repo
rm -f $(NAME).flatpak
install: $(NAME)
install -Dm755 $(NAME) "$(DESTDIR)/bin/$(NAME)"
install -Dm644 $(PKGNAME).desktop "$(DESTDIR)/share/applications/$(PKGNAME).desktop"
uninstall:
rm -f "$(DESTDIR)/bin/$(NAME)"
rm -f "$(DESTDIR)/share/applications/$(PKGNAME).desktop"
endif
endif
$(NAME): $(OFILES)
g++ -o $@ $(ARGS) $^ $(LIBS)
$(BUILD)/%.o: %.cpp $(HFILES) $(BUILD)
g++ -c -o $@ $(ARGS) $(INCS) $<
$(BUILD):
for dir in $(SRCS); do mkdir -p $(BUILD)/$$dir; done
switch:
$(MAKE) -f Makefile.switch
clean:
if [ -d "build-switch" ]; then $(MAKE) -f Makefile.switch clean; fi
rm -rf $(BUILD)
rm -f $(NAME)