]> Shamusworld >> Repos - apple2/blob - Makefile
Preliminary workings of a disk handling window. Added element visibility,
[apple2] / Makefile
1 #
2 # Unified Makefile for Apple 2 SDL
3 #
4 # by James L. Hammons
5 # (C) 2005 Underground Software
6 # This software is licensed under the GPL v2
7 #
8
9 # Figure out which system we're compiling for, and set the appropriate variables
10
11 ifeq "$(OSTYPE)" "msys"                                                 # Win32
12
13 SYSTYPE    = __GCCWIN32__
14 EXESUFFIX  = .exe
15 GLLIB      = -lopengl32
16 ICON       = obj/icon.o
17 SDLLIBTYPE = --libs
18 MSG        = Win32 on MinGW
19
20 else
21 #ifeq "$(OSTYPE)" "darwin"
22 ifeq "darwin" "$(findstring darwin,$(OSTYPE))"  # Should catch both 'darwin' and 'darwin7.0'
23
24 SYSTYPE    = __GCCUNIX__ -D_OSX_
25 EXESUFFIX  =
26 GLLIB      =
27 ICON       =
28 SDLLIBTYPE = --static-libs
29 MSG        = Mac OS X
30
31 else                                                                                    # *nix
32
33 SYSTYPE    = __GCCUNIX__
34 EXESUFFIX  =
35 GLLIB      = -lGL
36 ICON       =
37 SDLLIBTYPE = --libs
38 MSG        = generic Unix/Linux
39
40 endif
41 endif
42
43 CC         = gcc
44 LD         = gcc
45 TARGET     = apple2
46
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 -g
58 CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \
59                 -ffast-math `sdl-config --cflags` -pg -g
60 #               -fomit-frame-pointer `sdl-config --cflags` -g
61 #               -fomit-frame-pointer `sdl-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES
62
63 LDFLAGS =
64
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
70
71 INCS = -I. -I./src -I/usr/local/include -I/usr/include
72
73 OBJS = \
74         obj/button.o          \
75         obj/diskwindow.o      \
76         obj/draggablewindow.o \
77         obj/draggablewindow2.o \
78         obj/element.o         \
79         obj/gui.o             \
80         obj/guimisc.o         \
81         obj/menu.o            \
82         obj/text.o            \
83         obj/textedit.o        \
84         obj/window.o          \
85                           \
86         obj/applevideo.o      \
87         obj/ay8910.o          \
88         obj/dis65c02.o        \
89         obj/floppy.o          \
90         obj/log.o             \
91         obj/sdlemu_config.o   \
92         obj/sdlemu_opengl.o   \
93         obj/settings.o        \
94         obj/sound.o           \
95         obj/timing.o          \
96         obj/v65c02.o          \
97         obj/video.o           \
98         obj/apple2.o          \
99         $(ICON)
100
101 all: checkenv message obj $(TARGET)$(EXESUFFIX)
102         @echo
103         @echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m"
104
105 # Check the compilation environment, barf if not appropriate
106
107 checkenv:
108         @echo
109         @echo -en "\033[01;33m***\033[00;32m Checking compilation environment... \033[00m"
110 ifeq "" "$(shell which sdl-config)"
111         @echo
112         @echo
113         @echo -e "\033[01;33mIt seems that you don't have the SDL development libraries installed.
114         @echo -e "have installed them, make sure that the sdl-config file is somewhere in your"
115         @echo -e "path and is executable.\033[00m"
116         @echo
117 #Is there a better way to break out of the makefile?
118         @break
119 else
120         @echo -e "\033[01;37mOK\033[00m"
121 endif
122
123 message:
124         @echo
125         @echo -e "\033[01;33m***\033[00;32m Building Apple2 SDL for $(MSG)...\033[00m"
126         @echo
127
128 clean:
129         @echo -en "\033[01;33m***\033[00;32m Cleaning out the garbage...\033[00m"
130         @rm -rf obj
131         @rm -f ./$(TARGET)$(EXESUFFIX)
132         @echo -e "\033[01;37mdone!\033[00m"
133
134 obj:
135         @mkdir obj
136
137 # This is only done for Win32 at the moment...
138
139 ifneq "" "$(ICON)"
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
143 endif
144
145 obj/%.o: src/%.c
146         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
147         @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
148
149 obj/%.o: src/%.cpp
150         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
151         @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
152
153 #GUI compilation...
154 obj/%.o: src/gui/%.cpp
155         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
156         @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
157
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)
163
164 # Pull in dependencies autogenerated by gcc's -MMD switch
165 # The "-" in front in there just in case they haven't been created yet
166
167 -include obj/*.d