forked from Farama-Foundation/Arcade-Learning-Environment
-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile.mac
248 lines (198 loc) · 7.59 KB
/
makefile.mac
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
##============================================================================
# makefile for the A.L.E: Atari Learing Environment (Powered by Stella)
##============================================================================
srcdir ?= .
# Set this to 1 to enable SDL and display_screen
USE_SDL := 0
# Set this to 1 to enable the RLGlue interface
USE_RLGLUE := 0
DEFINES := -DRLGENV_NOMAINLOOP
LDFLAGS :=
# /opt/local/include for MacPorts; /usr/local/include for RL-Glue
INCLUDES := -Isrc/controllers -Isrc/os_dependent -I/usr/include -I/opt/local/include -I/usr/local/include -Isrc/environment -Isrc/external
LIBS_SDL := -lSDL -lSDLmain
LIBS_RLGLUE := -lrlutils -lrlgluenetdev
LIBS := -L/opt/local/lib
OBJS :=
PROF :=
MODULES :=
MODULE_DIRS :=
DISTNAME := atari_learning_environment
DEBUG := 0
# -------- Generated by configure -----------
CXX := g++
CXXFLAGS :=
LD := g++
# LIBS += -lz -lX11
# For the Mac
LIBS += -lz -framework Cocoa
RANLIB := ranlib
INSTALL := install
AR := ar cru
MKDIR := mkdir -p
ECHO := printf
CAT := cat
RM := rm -f
RM_REC := rm -f -r
ZIP := zip -q
CP := cp
# MODULES += src/unix
MODULE_DIRS +=
EXEEXT :=
NASM := /usr/bin/nasm
NASMFLAGS := -f elf
PREFIX := /usr/local
BINDIR := /usr/local/bin
DOCDIR := /usr/local/share/doc/stella
DATADIR := /usr/local/share
PROFILE :=
HAVE_GCC3 = 1
HAVE_NASM = 1
INCLUDES += -Isrc/games -Isrc/emucore -Isrc/emucore/m6502/src -Isrc/emucore/m6502/src/bspf/src -Isrc/common -Isrc/controllers -Isrc/environment
OBJS +=
DEFINES += -DUNIX -DHAS_ALTIVEC -DUSE_NASM -DBSPF_UNIX -DHAVE_INTTYPES -DWINDOWED_SUPPORT -DHAVE_GETTIMEOFDAY -DSNAPSHOT_SUPPORT
LDFLAGS +=
ifeq ("$(USE_SDL)", "1")
CXXFLAGS+=$(shell sdl-config --cflags)
LDFLAGS+=$(shell sdl-config --libs)
DEFINES += -D__USE_SDL -DSOUND_SUPPORT
endif
ifeq ("$(USE_RLGLUE)", "1")
DEFINES += -D__USE_RLGLUE
LIBS += $(LIBS_RLGLUE)
endif
# Uncomment this for stricter compile time code verification
# CXXFLAGS+= -Werror
CXXFLAGS += -Wall -Wunused -fPIC
ifeq ("$(DEBUG)", "1")
CXXFLAGS += -g -O0
else
CXXFLAGS += -O3
endif
ifdef PROFILE
PROF:= -g -pg -fprofile-arcs -ftest-coverage
CXXFLAGS+= $(PROF)
else
CXXFLAGS+= -fomit-frame-pointer
endif
# Even more warnings...
#CXXFLAGS+= -pedantic -Wpointer-arith -Wcast-qual -Wconversion
#CXXFLAGS+= -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor
#CXXFLAGS+= -Wno-reorder -Wwrite-strings -fcheck-new -Wctor-dtor-privacy
#######################################################################
# Misc stuff - you should never have to edit this #
#######################################################################
EXECUTABLE := ale$(EXEEXT)
LIBRARY := libale.so
all: tags $(EXECUTABLE) $(LIBRARY)
######################################################################
# Various minor settings
######################################################################
# The name for the directory used for dependency tracking
DEPDIR := .deps
######################################################################
# Module settings
######################################################################
MODULES := $(MODULES)
# After the game specific modules follow the shared modules
MODULES += \
src \
src/emucore \
src/emucore/m6502 \
src/common \
src/controllers \
src/os_dependent \
src/games \
src/environment \
src/external
######################################################################
# The build rules follow - normally you should have no need to
# touch whatever comes after here.
######################################################################
# Concat DEFINES and INCLUDES to form the CPPFLAGS
CPPFLAGS:= $(DEFINES) $(INCLUDES)
# Include the build instructions for all modules
-include $(addprefix $(srcdir)/, $(addsuffix /module.mk,$(MODULES)))
# Depdir information
DEPDIRS = $(addsuffix /$(DEPDIR),$(MODULE_DIRS))
DEPFILES =
# The build rule for the Stella executable
$(EXECUTABLE): $(OBJS)
$(LD) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) $(PROF) -o $@
$(LIBRARY): $(OBJS)
$(LD) $(LDFLAGS) -shared -o $(LIBRARY) $(OBJS) $(LIBS)
distclean: clean
$(RM_REC) $(DEPDIRS)
$(RM) build.rules config.h config.mak config.log
clean:
$(RM) $(OBJS) $(EXECUTABLE) $(LIBRARY)
.PHONY: all clean dist distclean
.SUFFIXES: .cxx
ifndef HAVE_GCC3
# If you use GCC, disable the above and enable this for intelligent
# dependency tracking.
.cxx.o:
$(MKDIR) $(*D)/$(DEPDIR)
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
.c.o:
$(MKDIR) $(*D)/$(DEPDIR)
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
else
# If you even have GCC 3.x, you can use this build rule, which is safer; the above
# rule can get you into a bad state if you Ctrl-C at the wrong moment.
# Also, with this GCC inserts additional dummy rules for the involved headers,
# which ensures a smooth compilation even if said headers become obsolete.
.cxx.o:
$(MKDIR) $(*D)/$(DEPDIR)
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
.c.o:
$(MKDIR) $(*D)/$(DEPDIR)
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
endif
ifdef HAVE_NASM
.SUFFIXES: .asm
.asm.o:
$(NASM) -O1 $(NASMFLAGS) -g -o $*.o $(<)
endif
# Include the dependency tracking files. We add /dev/null at the end
# of the list to avoid a warning/error if no .d file exist
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS))) /dev/null
# check if configure has been run or has been changed since last run
config.mak: $(srcdir)/configure
@echo "You need to run ./configure before you can run make"
@echo "Either you haven't run it before or it has changed."
@exit 1
install: all
$(INSTALL) -d "$(DESTDIR)$(BINDIR)"
$(INSTALL) -c -s -m 755 "$(srcdir)/stella$(EXEEXT)" "$(DESTDIR)$(BINDIR)/stella$(EXEEXT)"
$(INSTALL) -d "$(DESTDIR)$(DOCDIR)"
$(INSTALL) -c -m 644 "$(srcdir)/Announce.txt" "$(srcdir)/Changes.txt" "$(srcdir)/Copyright.txt" "$(srcdir)/License.txt" "$(srcdir)/README-SDL.txt" "$(srcdir)/Readme.txt" "$(srcdir)/Todo.txt" "$(srcdir)/docs/index.html" "$(srcdir)/docs/debugger.html" "$(DESTDIR)$(DOCDIR)/"
$(INSTALL) -d "$(DESTDIR)$(DOCDIR)/graphics"
$(INSTALL) -c -m 644 $(wildcard $(srcdir)/docs/graphics/*.png) "$(DESTDIR)$(DOCDIR)/graphics"
$(INSTALL) -d "$(DESTDIR)$(DATADIR)/applications"
$(INSTALL) -c -m 644 "$(srcdir)/src/unix/stella.desktop" "$(DESTDIR)$(DATADIR)/applications"
$(INSTALL) -d "$(DESTDIR)$(DATADIR)/icons"
$(INSTALL) -d "$(DESTDIR)$(DATADIR)/icons/mini"
$(INSTALL) -d "$(DESTDIR)$(DATADIR)/icons/large"
$(INSTALL) -c -m 644 "$(srcdir)/src/common/stella.png" "$(DESTDIR)$(DATADIR)/icons"
$(INSTALL) -c -m 644 "$(srcdir)/src/common/stella.png" "$(DESTDIR)$(DATADIR)/icons/mini"
$(INSTALL) -c -m 644 "$(srcdir)/src/common/stella.png" "$(DESTDIR)$(DATADIR)/icons/large"
install-strip: install
strip stella$(EXEEXT)
uninstall:
rm -f "$(DESTDIR)$(BINDIR)/stella$(EXEEXT)"
rm -rf "$(DESTDIR)$(DOCDIR)/"
rm -f "$(DESTDIR)$(DATADIR)/applications/stella.desktop"
rm -f "$(DESTDIR)$(DATADIR)/icons/stella.png"
rm -f "$(DESTDIR)$(DATADIR)/icons/mini/stella.png"
rm -f "$(DESTDIR)$(DATADIR)/icons/large/stella.png"
# Use Exuberant ctags (the one from Slackware's vim package, for instance),
# not the one from emacs!
tags:
ctags `find . -name '*.[ch]xx' -o -name '*.c' -o -name '*.y'` || true