-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.common
156 lines (120 loc) · 4.06 KB
/
Makefile.common
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Copyright (c) 2018-2024 Damien Ciabrini
# This file is part of ngdevkit
#
# ngdevkit is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# ngdevkit is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with ngdevkit. If not, see <http://www.gnu.org/licenses/>.
# --- Common configs ---
# When building a ROM, one must reuse the names of an existing
# cartridge, so that emulator can load them.
# Here, we arbitrarily defaults to names from puzzledp
MROM?=rom/202-m1.m1
SROM?=rom/202-s1.s1
PROM1?=rom/202-p1.p1
PROM?=$(PROM1)
VROM?=rom/202-v1.v1
CROM1?=rom/202-c1.c1
CROM2?=rom/202-c2.c2
CROM?=$(CROM1) $(CROM2)
GAMEROM?=puzzledp
CART?=rom/$(GAMEROM).zip
BIOS?=rom/neogeo.zip
cart: $(CART)
$(CART):
cd rom && for i in `ls -1 | grep -v -e \.bin -e \.zip`; do ln -nsf $$i $${i%.*}.bin; done; \
printf "===\nhttps://github.com/dciabrin/ngdevkit\n===" | zip -qz $(GAMEROM).zip `ls -1 | grep -v -e \.zip`
nullbios: $(BIOS)
$(BIOS): | rom
cp $(NULLBIOSDIR)/neogeo.zip rom
assets:
$(MAKE) -C $(ASSETS) all
rom:
mkdir $@
clean: common-clean
common-clean:
rm -rf *.elf *.o *~ rom
.PHONY: cart nullbios common-clean
# nullsound
define asm_label
$(shell echo $(1) | sed -e 's/\.[^.]*//' -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^\([0-9]\)/_\1/g' | tr A-Z a-z)
endef
# --- OS-specific targets ---
# macOS doesn't ship truncate
ifeq ($(shell uname -s), Darwin)
TRUNCATE=$(PYTHON) -c 'import sys;open(sys.argv[3],"a").truncate(int(sys.argv[2]))'
else
TRUNCATE=truncate
endif
ASSETS=../assets
# for macOS, may interfere with System Integrity Protection
define export_path
$(eval
ifeq ($(shell uname -s), Darwin)
$(1): export DYLD_LIBRARY_PATH=$(NGLIBDIR):$(DYLD_LIBRARY_PATH)
else
$(1): export LD_LIBRARY_PATH=$(NGLIBDIR):$(LD_LIBRARY_PATH)
endif
)
endef
# Emulator targets
#
# regular case: pass the rompath to the emulator
SCALE_WIN=3
SCALE_FULL=5
MAME=mame
MAME_RES_WIN=$(shell echo $$(($(SCALE_WIN)*320))x$$(($(SCALE_WIN)*224)))
ifeq ($(GNGEO_GLSL), yes)
SHADEROPTS=-b glsl
ifneq ($(ENABLE_MINGW),yes)
ifneq ($(SHADER_PATH),)
SHADEROPTS+= --shaderpath="$(SHADER_PATH)"
endif
endif
ifneq ($(SHADER),)
SHADEROPTS+= --shader="$(SHADER)"
endif
else
SHADEROPTS=
endif
ifneq ($(ENABLE_MINGW),yes)
$(call export_path,gngeo)
gngeo:
$(GNGEO) $(SHADEROPTS) $(EXTRAOPTS) --scale $(SCALE_WIN) --no-resize -i rom $(GAMEROM)
$(call export_path,gngeo-fullscreen)
gngeo-fullscreen:
$(GNGEO) $(SHADEROPTS) $(EXTRAOPTS) --fullscreen --scale $(SCALE_FULL) --no-resize -i rom $(GAMEROM)
mame:
$(MAME) -w -resolution $(MAME_RES_WIN) -noautosave -skip_gameinfo -rp rom $(GAMEROM)
mame-fullscreen:
$(MAME) -noautosave -skip_gameinfo -rp rom $(GAMEROM)
else
# MinGW: GnGeo is a native app, so instead of passing path to the
# Linux filesystem, we copy the ROM in the GnGeo directory
# we also copy any shader config that might be in use
ifneq ($(SHADER),)
ifneq ($(SHADER),noop.glslp)
ifneq ($(GLSL_SHADER_PATH),)
$(GNGEO_INSTALL_PATH)/shaders/$(SHADER): $(GLSL_SHADER_PATH)
$(RSYNC) -a $</ $(GNGEO_INSTALL_PATH)/shaders/
endif
endif
endif
gngeo:
cp $(CART) $(BIOS) $(GNGEO_INSTALL_PATH)/roms && (cd $(GNGEO_INSTALL_PATH) && $(GNGEO) $(SHADEROPTS) $(EXTRAOPTS) --scale $(SCALE_WIN) --no-resize $(GAMEROM))
gngeo-fullscreen:
cp $(CART) $(BIOS) $(GNGEO_INSTALL_PATH)/roms && (cd $(GNGEO_INSTALL_PATH) && $(GNGEO) $(SHADEROPTS) $(EXTRAOPTS) --fullscreen --scale $(SCALE_FULL) --no-resize $(GAMEROM))
mame:
cp $(CART) $(BIOS) $(GNGEO_INSTALL_PATH)/roms && ($(MAME) -w -resolution $(MAME_RES_WIN) -noautosave -skip_gameinfo -rp rom $(GAMEROM))
mame-fullscreen:
cp $(CART) $(BIOS) $(GNGEO_INSTALL_PATH)/roms && ($(MAME) -noautosave -skip_gameinfo -rp rom $(GAMEROM))
endif
.PHONY: gngeo gngeo-fullscreen