# # Makefile for StarGem 2 SDL # # by James L. Hammons # (C) 2005 Underground Software # This software is licensed under the GPL v2 # ifeq "$(OSTYPE)" "msys" # Win32 SYSTYPE = __GCCWIN32__ EXESUFFIX = .exe GLLIB = -lopengl32 ICON = obj/icon.o SDLLIBTYPE = --libs MSG = Win32 on MinGW else #ifeq "$(OSTYPE)" "darwin" ifeq "darwin" "$(findstring darwin,$(OSTYPE))" # Should catch both 'darwin' and 'darwin7.0' SYSTYPE = __GCCUNIX__ -D_OSX_ EXESUFFIX = GLLIB = ICON = SDLLIBTYPE = --static-libs MSG = Mac OS X else # *nix SYSTYPE = __GCCUNIX__ EXESUFFIX = GLLIB = -lGL ICON = SDLLIBTYPE = --libs MSG = generic Unix/Linux endif endif CC = gcc LD = gcc TARGET = stargem2 CFLAGS = -MMD -Wall -Wno-switch -Wno-uninitialized -O2 -D$(SYSTYPE) -fomit-frame-pointer `sdl-config --cflags` CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -Wno-uninitialized -O2 -D$(SYSTYPE) \ -fomit-frame-pointer `sdl-config --cflags` # -fomit-frame-pointer `sdl-config --cflags` -g # -fomit-frame-pointer `sdl-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES LDFLAGS = LIBS = -L/usr/local/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) INCS = -I. -Isrc -I/usr/local/include #THECC = $(CC) $(CFLAGS) $(INCS) OBJS = \ obj/dis6808.o \ obj/dis6809.o \ obj/log.o \ obj/v6808.o \ obj/v6809.o \ obj/video.o \ obj/settings.o \ obj/sound.o \ obj/sdlemu_config.o \ obj/sdlemu_opengl.o \ obj/timing.o \ obj/stargem2.o \ $(ICON) all: checkenv message obj $(TARGET)$(EXESUFFIX) @echo @echo "*** Looks like it compiled OK... Give it a whirl!" # Check the compilation environment, barf if not appropriate checkenv: @echo @echo -n "*** Checking compilation environment... " ifeq "" "$(shell which sdl-config)" @echo @echo @echo "It seems that you don't have the SDL development libraries installed. If you" @echo "have installed them, make sure that the sdl-config file is somewhere in your" @echo "path and is executable." @echo #Is there a better way to break out of the makefile? @break else @echo "OK" endif message: @echo @echo "*** Building StarGem 2 for $(MSG)..." @echo clean: @echo -n "*** Cleaning out the garbage..." @rm -rf obj @rm -f ./$(TARGET)$(EXESUFFIX) @echo "done!" obj: @mkdir obj # This is only done for Win32 at the moment... ifneq "" "$(ICON)" $(ICON): res/$(TARGET).rc res/$(TARGET).ico @echo "*** Processing icon..." @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res endif obj/%.o: src/%.c @echo "*** Compiling $<..." @$(CC) $(CFLAGS) $(INCS) -c $< -o $@ obj/%.o: src/%.cpp @echo "*** Compiling $<..." @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@ $(TARGET)$(EXESUFFIX): $(OBJS) @echo "*** Linking it all together..." @$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) # strip --strip-all $(TARGET)$(EXESUFFIX) # upx -9 $(TARGET)$(EXESUFFIX) # Pull in dependencies autogenerated by gcc's -MMD switch # The "-" in front in there just in case they haven't been created yet -include obj/*.d