ANESE
ANESE copied to clipboard
Fallback Makefile
ANESE doesn't compile on my linux machine with CMake, but the project structure is simple enough that a single Makefile would do... So I wrote a Makefile for ANESE that can be used on linux/unix as fallback for the CMake file. It uses pkg-config
(or u-config
) to automatically fetch the SDL2 compilation flags. Hopefully it is useful to you and others.
Unix.mk
# standard variables
CC = cc
CFLAGS = -Ithirdparty/headeronly -Ithirdparty/SDL_inprint \
-Ithirdparty/SimpleINI -Ithirdparty/miniz -Isrc \
`pkg-config --cflags sdl2` -O2
CXX = c++
CXXFLAGS = $(CFLAGS)
LDFLAGS = -s
LDLIBS = `pkg-config --libs sdl2`
# inference rules for compiling source files into object files
.SUFFIXES: .c .cc .cpp .o
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
.cc.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
# to generate a list of source files, run:
# find src -name *.cc | xargs printf '%s \\\n'
CCFILES = \
src/ui/SDL2/shared_state.cc \
src/ui/SDL2/movies/fm2/replay.cc \
src/ui/SDL2/movies/fm2/record.cc \
src/ui/SDL2/main.cc \
src/ui/SDL2/gui_modules/widenes.cc \
src/ui/SDL2/gui_modules/submodules/menu.cc \
src/ui/SDL2/gui_modules/single_header_impls.cc \
src/ui/SDL2/gui_modules/ppu_debug.cc \
src/ui/SDL2/gui_modules/emu.cc \
src/ui/SDL2/gui.cc \
src/ui/SDL2/fs/util.cc \
src/ui/SDL2/fs/load.cc \
src/ui/SDL2/config.cc \
src/nes/wiring/ppu_mmu.cc \
src/nes/wiring/interrupt_lines.cc \
src/nes/wiring/cpu_mmu.cc \
src/nes/ppu/ppu.cc \
src/nes/nes.cc \
src/nes/joy/joy.cc \
src/nes/joy/controllers/zapper.cc \
src/nes/joy/controllers/standard.cc \
src/nes/generic/rom/rom.cc \
src/nes/generic/ram/ram.cc \
src/nes/cpu/nestest.cc \
src/nes/cpu/cpu.cc \
src/nes/cartridge/parse_rom.cc \
src/nes/cartridge/mappers/mapper_009.cc \
src/nes/cartridge/mappers/mapper_007.cc \
src/nes/cartridge/mappers/mapper_004.cc \
src/nes/cartridge/mappers/mapper_003.cc \
src/nes/cartridge/mappers/mapper_002.cc \
src/nes/cartridge/mappers/mapper_001.cc \
src/nes/cartridge/mappers/mapper_000.cc \
src/nes/cartridge/mapper.cc \
src/nes/apu/apu.cc \
src/common/serializable.cc \
# consider renaming this to .cc so it gets included in the list above
CPPFILES = \
src/ui/SDL2/util/Sound_Queue.cpp \
# list third party source files using the same command
# then manually remove any unneeded files
TPCFILES = \
thirdparty/miniz/miniz_zip.c \
thirdparty/miniz/miniz_tinfl.c \
thirdparty/miniz/miniz_tdef.c \
thirdparty/miniz/miniz.c \
thirdparty/SimpleINI/ConvertUTF.c \
TPCCFILES = \
thirdparty/SDL_inprint/SDL_inprint2.cc \
# all objects
OBJS = $(CCFILES:.cc=.o) $(CPPFILES:.cpp=.o) \
$(TPCFILES:.c=.o) $(TPCCFILES:.cc=.o) \
# targets
all: anese
anese: $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
clean:
rm -rf anese $(OBJS)
I went ahead and make this a pinned issue, so it maintains good visibility.
If the CMake file is well and truly busted though, it would be good if you / someone else could send in a PR fixing it.
I went ahead and make this a pinned issue
Thank you!
If the CMake file is well and truly busted though, it would be good if you / someone else could send in a PR fixing it.
The only problem with the current CMake file is that it cannot find SDL2, all other dependencies are accounted for (huge thanks for that btw). After some searching I found this page on the official SDL wiki, in a nutshell:
- SDL2 natively supports CMake since version 2.0.4, no need for
FindSDL2.cmake
- Minimum CMake version is 3.5 (not sure if this is a hard requirement)
- There are two separate CMake packages for the shared and static SDL2 libraries
I updated the CMake file to reflect this information with some very minor cleanups, feel free to give it a try on your machine and report back... That being said, I still recommend keeping a fallback Makefile in case CMake breaks anything in the future.
Note: it might be a good idea to add a user option for manually selecting the static or shared SDL2 library.
As you might be able to tell by the lack of commit history, this project is very much in deep maintenance mode on my end.
If you're confident in your changes, feel free to send in a PR with the changes, and I'll go ahead and merge it in.