# File: Makefile.msys2.sdl2 # Makefile for compiling Angband with SDL2. # # This makefile requires GNU make. # # This makefile is intended for use with GNU make and mingw in the msys2 # environment for Windows (within msys2 run "pacman -S mingw-w64-x86_64-gcc ; # pacman -S make" to install those). # # The video subsystem requires libsdl2, libsdl2-ttf and libsdl2-image # (within msys2 run "pacman -S mingw-w64-x86_64-SDL2 ; # pacman -S mingw-w64-x86_64-SDL2_ttf ; pacman -S mingw-w64-x86_64-SDL2_image" # to install those). # # The sound subsystem requires libsdl2 and libsdl2-mixer (libsdl2 is already # installed for the video subsystem; to install libsdl2-mixer run # "pacman -S mingw-w64-x86_64-SDL2_mixer" in msys2). # # If you want only video (but not sound), use it like this: # (from angband directory) # # cd src # make -f Makefile.msys2.sdl # # To also have SDL2 sound, change the second of those commands to: # make -f Makefile.msys2.sdl2 SOUND=yes # # By default, copy the executable to ../ so that # you don't find yourself debugging a stale copy. .PHONY: default default: install # Support SDL2 frontend, link all dependencies statically # freetype and harfbuzz has Circular dependency VIDEO_sdl2_cflags := \ -DUSE_SDL2 \ $(shell sdl2-config --cflags) \ VIDEO_sdl2_ldflags := \ $(shell sdl2-config --static-libs) \ -lSDL2_ttf -lSDL2_image \ -ltiff \ -ljbig \ -lLerc \ -lzstd \ -llzma \ -ljxl \ -lhwy \ -lwebp \ -lsharpyuv \ -lfreetype \ -lharfbuzz \ -lDwrite \ -lfreetype \ -lbrotlidec \ -lbrotlicommon \ -lgraphite2 \ -lpng \ -ldeflate \ -ljpeg \ -lbz2 \ -lintl \ -lrpcrt4 \ -lz \ -lVersion \ -lstdc++ \ -lImm32 \ -lhid \ -lsetupapi \ -lole32 \ -loleaut32 \ -lwinmm \ ## Support SDL_mixer for sound ifdef SOUND SOUND_sdl2_cflags := \ -DSOUND_SDL2 \ -DSOUND \ $(shell sdl2-config --cflags) \ SOUND_sdl2_ldflags := \ $(shell sdl2-config --libs) \ -lSDL2_mixer \ -lmpg123 \ -lopusfile \ -lopus \ -logg \ -lshlwapi \ -lwinmm endif # Compiler to use CC := gcc WARNINGS = -W -Wall -Wextra -Wno-unused-parameter \ -Wno-missing-field-initializers -Wwrite-strings -Wmissing-prototypes \ -Wnested-externs -Wshadow -Wunused-macros # Flags to use in compilation CFLAGS := -std=c99 \ -g \ -O2 \ $(WARNINGS) -pedantic \ -static \ -DUSE_PRIVATE_PATHS \ -DHAVE_DIRENT_H \ -DMSYS2_ENCODING_WORKAROUND # Linker flags LDFLAGS := # Frontends to compile MODULES_cflags := $(VIDEO_sdl2_cflags) MODULES_ldflags := $(VIDEO_sdl2_ldflags) ifdef SOUND MODULES_cflags += $(SOUND_sdl2_cflags) MODULES_ldflags += $(SOUND_sdl2_ldflags) endif CFLAGS += $(MODULES_cflags) LDFLAGS += $(MODULES_ldflags) # Makefile.inc contains an up-to-date set of object files to compile include Makefile.inc #### Targets and objects ##### # Program name (PROGNAME comes from Makefile.src via Makefile.inc) EXE := $(PROGNAME) # Object definitions (BASEOBJS come from Makefile.inc) OBJS := main.o main-sdl2.o $(BASEOBJS) ifdef SOUND OBJS += snd-sdl.o endif # Build the "Angband" program $(EXE): $(OBJS) @printf "%10s %-20s\n" LINK $@ @$(CC) -o $(EXE) $(OBJS) $(CFLAGS) $(LDFLAGS) # Install the game. .PHONY: install install: ../$(EXE) ../$(EXE): $(EXE) cp $(EXE) .. # Clean up old junk .PHONY: clean clean: -rm -f $(OBJS) $(EXE) snd-sdl.o # Verify module arguments .PHONY: args args: @echo CFLAGS = $(CFLAGS) @echo "---" @echo LDFLAGS = $(LDFLAGS) @echo "---" @echo MODULES = $(MODULES) @echo "---" @echo INCLUDES = $(INCLUDES) # Some file dependencies %.o: %.c @printf "%10s %-20s\n" CC $< @$(CC) -o $@ -c $< $(CFLAGS)