forked from Hydr8gon/NooDS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
109 lines (85 loc) · 2.69 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
NAME := noods
BUILD := build
SRCS := src src/common src/desktop
ARGS := -Ofast -flto -std=c++11 -DUSE_GL_CANVAS #-DDEBUG
LIBS := $(shell pkg-config --libs portaudio-2.0)
INCS := $(shell pkg-config --cflags portaudio-2.0)
APPNAME := NooDS
PKGNAME := com.hydra.noods
DESTDIR ?= /usr
ifeq ($(OS),Windows_NT)
ARGS += -static -DWINDOWS
LIBS += $(shell wx-config-static --libs --gl-libs) -lole32 -lsetupapi -lwinmm
INCS += $(shell wx-config-static --cxxflags)
else
LIBS += $(shell wx-config --libs --gl-libs)
INCS += $(shell wx-config --cxxflags)
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))
ifeq ($(OS),Windows_NT)
OFILES += $(BUILD)/icon-windows.o
endif
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"
install -Dm644 icon/icon-linux.png "$(DESTDIR)/share/icons/hicolor/64x64/apps/$(PKGNAME).png"
uninstall:
rm -f "$(DESTDIR)/bin/$(NAME)"
rm -f "$(DESTDIR)/share/applications/$(PKGNAME).desktop"
rm -f "$(DESTDIR)/share/icons/hicolor/64x64/apps/$(PKGNAME).png"
endif
endif
$(NAME): $(OFILES)
g++ -o $@ $(ARGS) $^ $(LIBS)
$(BUILD)/%.o: %.cpp $(HFILES) $(BUILD)
g++ -c -o $@ $(ARGS) $(INCS) $<
$(BUILD)/icon-windows.o:
windres $(shell wx-config-static --cppflags) icon/icon-windows.rc $@
$(BUILD):
for dir in $(SRCS); do mkdir -p $(BUILD)/$$dir; done
android-bundle:
git apply src/android/play-store.patch
./gradlew bundle
git apply -R src/android/play-store.patch
jarsigner -keystore keystore.jks -signedjar noods.aab build-android/outputs/bundle/release/android-release.aab keystore
android:
./gradlew assembleDebug
switch:
$(MAKE) -f Makefile.switch
wiiu:
$(MAKE) -f Makefile.wiiu
vita:
$(MAKE) -f Makefile.vita
clean:
if [ -d "build-android" ]; then ./gradlew clean; fi
if [ -d "build-switch" ]; then $(MAKE) -f Makefile.switch clean; fi
if [ -d "build-wiiu" ]; then $(MAKE) -f Makefile.wiiu clean; fi
if [ -d "build-vita" ]; then $(MAKE) -f Makefile.vita clean; fi
rm -rf $(BUILD)
rm -f $(NAME)