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
110
111
112
113
114
115
116
117
118
119
120
|
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,26 @@
-CC ?= cc
-CXX ?= c++
-CXXFLAGS ?= -O3
-CPPFLAGS += -DNST_PRAGMA_ONCE
-CFLAGS = $(shell sdl2-config --cflags)
-
-INCLUDES = -Isource
+nestopia_CPPFLAGS = -DNST_PRAGMA_ONCE -Isource $(shell sdl2-config --cflags)
WARNINGS = -Wno-write-strings
-LDFLAGS = -Wl,--as-needed
-LIBS = -lstdc++ -lm -lz
-LIBS += $(shell sdl2-config --libs)
+nestopia_LIBS = -lm -lz $(shell sdl2-config --libs)
UNAME := $(shell uname)
BIN = nestopia
-PREFIX ?= /usr/local
+PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
DATADIR ?= $(PREFIX)/share/nestopia
ifneq ($(findstring MINGW,$(UNAME)),)
- DEFINES = -D_MINGW
- LDFLAGS += -mconsole
- LIBS += -lepoxy -lopengl32
+ nestopia_CPPFLAGS += -D_MINGW
+ nestopia_LIBS += -mconsole
+ nestopia_LIBS += -lepoxy -lopengl32
else ifneq ($(findstring Darwin,$(UNAME)),)
- DEFINES = -D_APPLE
- DEFINES += -DDATADIR=\"$(DATADIR)\"
- INCLUDES += -I/usr/local/include -I/usr/local/opt/libarchive/include
- LDFLAGS = -Wl -L/usr/local/opt/libarchive/lib
- LIBS += -larchive -lepoxy -lao
+ nestopia_CPPFLAGS += -D_APPLE
+ nestopia_CPPFLAGS += -DDATADIR=\"$(DATADIR)\"
+ nestopia_CPPFLAGS += -I/usr/local/include -I/usr/local/opt/libarchive/include
+ nestopia_LIBS += -Wl -L/usr/local/opt/libarchive/lib
+ nestopia_LIBS += -larchive -lepoxy -lao
# GTK Stuff - Comment this section to disable GTK+
#CFLAGS += $(shell pkg-config --cflags gtk+-3.0)
#LIBS += $(shell pkg-config --libs gtk+-3.0)
@@ -43,12 +35,12 @@
#WARNINGS += -Wno-deprecated-declarations
# end GTK
else
- DEFINES = -DDATADIR=\"$(DATADIR)\"
- LIBS += -larchive -lepoxy -lGL -lGLU -lao
+ nestopia_CPPFLAGS += -DDATADIR=\"$(DATADIR)\"
+ nestopia_LIBS += -larchive -lepoxy -lGL -lGLU -lao
# GTK Stuff - Comment this section to disable GTK+
- CFLAGS += $(shell pkg-config --cflags gtk+-3.0)
- LIBS += $(shell pkg-config --libs gtk+-3.0)
- DEFINES += -D_GTK
+ nestopia_CPPFLAGS += $(shell pkg-config --cflags gtk+-3.0)
+ nestopia_LIBS += $(shell pkg-config --libs gtk+-3.0)
+ nestopia_CPPFLAGS += -D_GTK
IOBJS += objs/unix/gtkui/gtkui.o
IOBJS += objs/unix/gtkui/gtkui_archive.o
IOBJS += objs/unix/gtkui/gtkui_callbacks.o
@@ -374,11 +366,11 @@
# Core rules
objs/core/%.o: source/core/%.cpp
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
+ $(CXX) $(nestopia_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(WARNINGS) -c $< -o $@
# Interface rules
objs/unix/%.o: source/unix/%.cpp
- $(CXX) $(CXXFLAGS) $(INCLUDES) $(WARNINGS) $(DEFINES) $(CFLAGS) -c $< -o $@
+ $(CXX) $(nestopia_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(WARNINGS) -c $< -o $@
all: maketree $(BIN)
@@ -392,19 +384,28 @@
@mkdir -p $@
$(BIN): $(OBJS) $(IOBJS)
- $(CC) $(LDFLAGS) $^ $(LIBS) -o $(BIN)
+ $(CXX) $(LDFLAGS) $(CXXFLAGS) $^ $(nestopia_LIBS) $(LIBS) -o $(BIN)
install:
- mkdir -p $(BINDIR)
- mkdir -p $(DATADIR)/icons
- mkdir -p $(PREFIX)/share/pixmaps
- install -m 0755 $(BIN) $(BINDIR)
- install -m 0644 source/unix/icons/nestopia.desktop $(DATADIR)
- install -m 0644 NstDatabase.xml $(DATADIR)
- install -m 0644 source/unix/icons/*.png $(DATADIR)/icons
- install -m 0644 source/unix/icons/*.svg $(DATADIR)/icons
- install -m 0644 source/unix/icons/nestopia.svg $(PREFIX)/share/pixmaps
- xdg-desktop-menu install --novendor $(DATADIR)/nestopia.desktop
+ mkdir -p $(DESTDIR)$(BINDIR)
+ mkdir -p $(DESTDIR)$(DATADIR)
+ mkdir -p $(DESTDIR)$(PREFIX)/share/applications/
+ mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps
+ mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps
+ mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps
+ mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/96x96/apps
+ mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps
+ mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
+ mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps
+ install -m 0755 $(BIN) $(DESTDIR)$(BINDIR)
+ install -m 0644 NstDatabase.xml $(DESTDIR)$(DATADIR)
+ install -m 0644 source/unix/icons/nestopia.desktop $(DESTDIR)$(PREFIX)/share/applications/
+ install -m 0644 source/unix/icons/nestopia32.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps/nestopia.png
+ install -m 0644 source/unix/icons/nestopia48.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/nestopia.png
+ install -m 0644 source/unix/icons/nestopia64.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/64x64/apps/nestopia.png
+ install -m 0644 source/unix/icons/nestopia96.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/96x96/apps/nestopia.png
+ install -m 0644 source/unix/icons/nestopia128.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/nestopia.png
+ install -m 0644 source/unix/icons/*.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
uninstall:
xdg-desktop-menu uninstall $(DATADIR)/nestopia.desktop
|