2 # Unified Makefile for Apple 2 SDL
5 # (C) 2005 Underground Software
6 # This software is licensed under the GPL v2
11 # Figure out which system we're compiling for, and set the appropriate variables
13 ifeq "$(OSTYPE)" "msys" # Win32
15 SYSTYPE = __GCCWIN32__
22 #ifeq "$(OSTYPE)" "darwin"
23 ifeq "darwin" "$(findstring darwin,$(OSTYPE))" # Should catch both 'darwin' and 'darwin7.0'
25 SYSTYPE = __GCCUNIX__ -D_OSX_
28 SDLLIBTYPE = --static-libs
37 MSG = generic Unix/Linux
46 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
47 #CFLAGS = -MMD -Wall -Wno-switch -O2 -D$(SYSTYPE) -ffast-math -fomit-frame-pointer `sdl2-config --cflags`
48 #CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -O2 -D$(SYSTYPE) \
49 # No optimization and w/gcov flags, so that we get an accurate picture from gcov
50 #CFLAGS = -MMD -Wall -Wno-switch -D$(SYSTYPE) \
51 # -ffast-math -fomit-frame-pointer `sdl2-config --cflags` -fprofile-arcs -ftest-coverage
52 #CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \
53 # -ffast-math -fomit-frame-pointer `sdl2-config --cflags` -fprofile-arcs -ftest-coverage
54 # No optimization for profiling with gprof...
55 CFLAGS = -MMD -Wall -Wno-switch -D$(SYSTYPE) \
56 -ffast-math `sdl2-config --cflags` -pg -g
57 CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \
58 -ffast-math `sdl2-config --cflags` -pg -g
59 # -fomit-frame-pointer `sdl2-config --cflags` -g
60 # -fomit-frame-pointer `sdl2-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES
64 #LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB)
65 # Link in the gcov library (for profiling purposes)
66 #LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -lgcov
67 # Link in the gprof lib
68 LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -pg
70 INCS = -I. -I./src -I/usr/local/include -I/usr/include
75 obj/draggablewindow.o \
76 obj/draggablewindow2.o \
101 all: checkenv message obj $(TARGET)$(EXESUFFIX)
103 @echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m"
105 # Check the compilation environment, barf if not appropriate
109 @echo -en "\033[01;33m***\033[00;32m Checking compilation environment... \033[00m"
110 ifeq "" "$(shell which sdl2-config)"
113 @echo -e "\033[01;33mIt seems that you don't have the SDL 2 development libraries installed.
114 @echo -e "have installed them, make sure that the sdl2-config file is somewhere in your"
115 @echo -e "path and is executable.\033[00m"
117 #Is there a better way to break out of the makefile?
120 @echo -e "\033[01;37mOK\033[00m"
125 @echo -e "\033[01;33m***\033[00;32m Building Apple2 SDL for $(MSG)...\033[00m"
129 @echo -en "\033[01;33m***\033[00;32m Cleaning out the garbage...\033[00m"
131 @rm -f ./$(TARGET)$(EXESUFFIX)
132 @echo -e "\033[01;37mdone!\033[00m"
137 # This is only done for Win32 at the moment...
140 $(ICON): res/$(TARGET).rc res/$(TARGET).ico
141 @echo -e "\033[01;33m***\033[00;32m Processing icon...\033[00m"
142 @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res
146 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
147 @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
150 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
151 @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
154 obj/%.o: src/gui/%.cpp
155 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
156 @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
158 $(TARGET)$(EXESUFFIX): $(OBJS)
159 @echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
160 @$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
161 # strip --strip-all vj$(EXESUFFIX)
162 # upx -9 vj$(EXESUFFIX)
165 @echo -n "Lines in source files: "
166 @-$(FIND) ./src -name "*.cpp" | xargs cat | wc -l
167 @echo -n "Lines in header files: "
168 @-$(FIND) ./src -name "*.h" | xargs cat | wc -l
170 # Pull in dependencies autogenerated by gcc's -MMD switch
171 # The "-" in front in there just in case they haven't been created yet