2 # Unified Makefile for Apple 2 SDL
5 # (C) 2005 Underground Software
6 # This software is licensed under the GPL v2
9 # Figure out which system we're compiling for, and set the appropriate variables
11 ifeq "$(OSTYPE)" "msys" # Win32
13 SYSTYPE = __GCCWIN32__
21 #ifeq "$(OSTYPE)" "darwin"
22 ifeq "darwin" "$(findstring darwin,$(OSTYPE))" # Should catch both 'darwin' and 'darwin7.0'
24 SYSTYPE = __GCCUNIX__ -D_OSX_
28 SDLLIBTYPE = --static-libs
38 MSG = generic Unix/Linux
47 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
48 #CFLAGS = -MMD -Wall -Wno-switch -O2 -D$(SYSTYPE) -ffast-math -fomit-frame-pointer `sdl-config --cflags`
49 #CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -O2 -D$(SYSTYPE) \
50 # No optimization and w/gcov flags, so that we get an accurate picture from gcov
51 #CFLAGS = -MMD -Wall -Wno-switch -D$(SYSTYPE) \
52 # -ffast-math -fomit-frame-pointer `sdl-config --cflags` -fprofile-arcs -ftest-coverage
53 #CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \
54 # -ffast-math -fomit-frame-pointer `sdl-config --cflags` -fprofile-arcs -ftest-coverage
55 # No optimization for profiling with gprof...
56 CFLAGS = -MMD -Wall -Wno-switch -D$(SYSTYPE) \
57 -ffast-math `sdl-config --cflags` -pg
58 CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \
59 -ffast-math `sdl-config --cflags` -pg
60 # -fomit-frame-pointer `sdl-config --cflags` -g
61 # -fomit-frame-pointer `sdl-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES
65 #LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB)
66 # Link in the gcov library (for profiling purposes)
67 #LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -lgcov
68 # Link in the gprof lib
69 LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -pg
71 INCS = -I. -I./src -I/usr/local/include -I/usr/include
75 obj/draggablewindow.o \
98 all: checkenv message obj $(TARGET)$(EXESUFFIX)
100 @echo "*** Looks like it compiled OK... Give it a whirl!"
102 # Check the compilation environment, barf if not appropriate
106 @echo -n "*** Checking compilation environment... "
107 ifeq "" "$(shell which sdl-config)"
110 @echo "It seems that you don't have the SDL development libraries installed. If you"
111 @echo "have installed them, make sure that the sdl-config file is somewhere in your"
112 @echo "path and is executable."
114 #Is there a better way to break out of the makefile?
122 @echo "*** Building Apple 2 SDL for $(MSG)..."
126 @echo -n "*** Cleaning out the garbage..."
128 @rm -f ./$(TARGET)$(EXESUFFIX)
134 # This is only done for Win32 at the moment...
137 $(ICON): res/$(TARGET).rc res/$(TARGET).ico
138 @echo "*** Processing icon..."
139 @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res
143 @echo "*** Compiling $<..."
144 @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
147 @echo "*** Compiling $<..."
148 @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
151 obj/%.o: src/gui/%.cpp
152 @echo "*** Compiling $<..."
153 @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
155 $(TARGET)$(EXESUFFIX): $(OBJS)
156 @echo "*** Linking it all together..."
157 @$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
158 # strip --strip-all vj$(EXESUFFIX)
159 # upx -9 vj$(EXESUFFIX)
161 # Pull in dependencies autogenerated by gcc's -MMD switch
162 # The "-" in front in there just in case they haven't been created yet