2 # Makefile for StarGem 2 SDL
5 # (C) 2005 Underground Software
6 # This software is licensed under the GPL v2
9 ifeq "$(OSTYPE)" "msys" # Win32
11 SYSTYPE = __GCCWIN32__
19 #ifeq "$(OSTYPE)" "darwin"
20 ifeq "darwin" "$(findstring darwin,$(OSTYPE))" # Should catch both 'darwin' and 'darwin7.0'
22 SYSTYPE = __GCCUNIX__ -D_OSX_
26 SDLLIBTYPE = --static-libs
36 MSG = generic Unix/Linux
45 CFLAGS = -MMD -Wall -Wno-switch -Wno-uninitialized -O2 -D$(SYSTYPE) -fomit-frame-pointer `sdl-config --cflags`
46 CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -Wno-uninitialized -O2 -D$(SYSTYPE) \
47 -fomit-frame-pointer `sdl-config --cflags` \
49 # -DLOG_UNMAPPED_MEMORY_ACCESSES
53 LIBS = -L/usr/local/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB)
55 INCS = -I. -Isrc -I/usr/local/include
72 all: checkenv message obj $(TARGET)$(EXESUFFIX)
74 @echo "*** Looks like it compiled OK... Give it a whirl!"
76 # Check the compilation environment, barf if not appropriate
80 @echo -n "*** Checking compilation environment... "
81 ifeq "" "$(shell which sdl-config)"
84 @echo "It seems that you don't have the SDL development libraries installed. If you"
85 @echo "have installed them, make sure that the sdl-config file is somewhere in your"
86 @echo "path and is executable."
88 #Is there a better way to break out of the makefile?
96 @echo "*** Building StarGem 2 for $(MSG)..."
100 @echo -n "*** Cleaning out the garbage..."
102 @rm -f ./$(TARGET)$(EXESUFFIX)
108 # This is only done for Win32 at the moment...
111 $(ICON): res/$(TARGET).rc res/$(TARGET).ico
112 @echo "*** Processing icon..."
113 @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res
117 @echo "*** Compiling $<..."
118 @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
121 @echo "*** Compiling $<..."
122 @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
124 $(TARGET)$(EXESUFFIX): $(OBJS)
125 @echo "*** Linking it all together..."
126 @$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
127 # strip --strip-all $(TARGET)$(EXESUFFIX)
128 # upx -9 $(TARGET)$(EXESUFFIX)
130 # Pull in dependencies autogenerated by gcc's -MMD switch
131 # The "-" in front in there just in case they haven't been created yet