2 # Makefile for Thunder SDL
5 # (C) 2009 Underground Software
6 # This software is licensed under the GPL v3 or later
9 ifeq "$(OSTYPE)" "msys" # Win32
11 SYSTYPE = __GCCWIN32__
15 SDLLIBTYPE = --static-libs
20 #ifeq "$(OSTYPE)" "darwin"
21 ifeq "darwin" "$(findstring darwin,$(OSTYPE))" # Should catch both 'darwin' and 'darwin7.0'
23 SYSTYPE = __GCCUNIX__ -D_OSX_
27 SDLLIBTYPE = --static-libs
37 MSG = generic Unix/Linux
46 CFLAGS = -MMD -Wall -Wno-switch -Wno-uninitialized -Wno-unused -O2 -D$(SYSTYPE) -fomit-frame-pointer `sdl2-config --cflags`
47 CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -Wno-uninitialized -Wno-unused -O2 -D$(SYSTYPE) \
48 -fomit-frame-pointer `sdl2-config --cflags` \
50 # -DLOG_UNMAPPED_MEMORY_ACCESSES
54 # Ugh, let's get rid of the ref to -lcurses [DONE]
55 LIBS = `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz -lm $(GLLIB) $(EXTRA)
76 all: checkenv message obj $(TARGET)$(EXESUFFIX)
78 @echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m"
80 # Check the compilation environment, barf if not appropriate
84 @echo -en "\033[01;33m***\033[00;32m Checking compilation environment... \033[00m"
85 ifeq "" "$(shell which sdl2-config)"
88 @echo -e "\033[01;33mIt seems that you don't have the SDL development libraries installed.
89 @echo -e "have installed them, make sure that the sdl-config file is somewhere in your"
90 @echo -e "path and is executable.\033[00m"
92 #Is there a better way to break out of the makefile?
95 @echo -e "\033[01;37mOK\033[00m"
100 @echo -e "\033[01;33m***\033[00;32m Building Thunder/SDL for $(MSG)...\033[00m"
104 @echo -en "\033[01;33m***\033[00;32m Cleaning out the garbage...\033[00m"
106 @rm -f ./$(TARGET)$(EXESUFFIX)
107 @echo -e "\033[01;37mdone!\033[00m"
112 # This is only done for Win32 at the moment...
115 $(ICON): res/$(TARGET).rc res/$(TARGET).ico
116 @echo -e "\033[01;33m***\033[00;32m Processing icon...\033[00m"
117 @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res
121 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
122 @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
125 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
126 @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
129 @echo -e "\033[01;33m***\033[00;32m Assembling $<...\033[00m"
130 @nasm -f elf64 -I ./res/ $< -o $@
132 $(TARGET)$(EXESUFFIX): $(OBJS)
133 @echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
134 @$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
135 # strip --strip-all $(TARGET)$(EXESUFFIX)
136 # upx -9 $(TARGET)$(EXESUFFIX)
138 # Pull in dependencies autogenerated by gcc's -MMD switch
139 # The "-" in front in there just in case they haven't been created yet