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