]> Shamusworld >> Repos - apple2/blob - Makefile
Fixed log hangup on exit, added paddle buttons 0 & 1.
[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 ICON       = obj/icon.o
16 SDLLIBTYPE = --libs
17 MSG        = Win32 on MinGW
18
19 else
20 #ifeq "$(OSTYPE)" "darwin"
21 ifeq "darwin" "$(findstring darwin,$(OSTYPE))"  # Should catch both 'darwin' and 'darwin7.0'
22
23 SYSTYPE    = __GCCUNIX__ -D_OSX_
24 EXESUFFIX  =
25 ICON       =
26 SDLLIBTYPE = --static-libs
27 MSG        = Mac OS X
28
29 else                                                                                    # *nix
30
31 SYSTYPE    = __GCCUNIX__
32 EXESUFFIX  =
33 ICON       =
34 SDLLIBTYPE = --libs
35 MSG        = generic Unix/Linux
36
37 endif
38 endif
39
40 CC         = gcc
41 LD         = gcc
42 TARGET     = apple2
43
44 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
45 #CFLAGS   = -MMD -Wall -Wno-switch -O2 -D$(SYSTYPE) -ffast-math -fomit-frame-pointer `sdl2-config --cflags`
46 #CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -O2 -D$(SYSTYPE) \
47 # No optimization and w/gcov flags, so that we get an accurate picture from gcov
48 #CFLAGS   = -MMD -Wall -Wno-switch -D$(SYSTYPE) \
49 #               -ffast-math -fomit-frame-pointer `sdl2-config --cflags` -fprofile-arcs -ftest-coverage
50 #CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \
51 #               -ffast-math -fomit-frame-pointer `sdl2-config --cflags` -fprofile-arcs -ftest-coverage
52 # No optimization for profiling with gprof...
53 CFLAGS   = -MMD -Wall -Wno-switch -D$(SYSTYPE) \
54                 -ffast-math `sdl2-config --cflags` -pg -g
55 CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -D$(SYSTYPE) \
56                 -ffast-math `sdl2-config --cflags` -pg -g
57 #               -fomit-frame-pointer `sdl2-config --cflags` -g
58 #               -fomit-frame-pointer `sdl2-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES
59
60 LDFLAGS =
61
62 #LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB)
63 # Link in the gcov library (for profiling purposes)
64 #LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -lgcov
65 # Link in the gprof lib
66 LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -pg
67
68 INCS = -I. -I./src -I/usr/local/include -I/usr/include
69
70 OBJS = \
71         obj/button.o          \
72         obj/diskwindow.o      \
73         obj/draggablewindow.o \
74         obj/draggablewindow2.o \
75         obj/element.o         \
76         obj/gui.o             \
77         obj/guimisc.o         \
78         obj/menu.o            \
79         obj/text.o            \
80         obj/textedit.o        \
81         obj/window.o          \
82                           \
83         obj/applevideo.o      \
84         obj/ay8910.o          \
85         obj/dis65c02.o        \
86         obj/floppy.o          \
87         obj/log.o             \
88         obj/sdlemu_config.o   \
89         obj/settings.o        \
90         obj/sound.o           \
91         obj/timing.o          \
92         obj/v65c02.o          \
93         obj/video.o           \
94         obj/apple2.o          \
95         $(ICON)
96
97 all: checkenv message obj $(TARGET)$(EXESUFFIX)
98         @echo
99         @echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m"
100
101 # Check the compilation environment, barf if not appropriate
102
103 checkenv:
104         @echo
105         @echo -en "\033[01;33m***\033[00;32m Checking compilation environment... \033[00m"
106 ifeq "" "$(shell which sdl2-config)"
107         @echo
108         @echo
109         @echo -e "\033[01;33mIt seems that you don't have the SDL 2 development libraries installed.
110         @echo -e "have installed them, make sure that the sdl2-config file is somewhere in your"
111         @echo -e "path and is executable.\033[00m"
112         @echo
113 #Is there a better way to break out of the makefile?
114         @break
115 else
116         @echo -e "\033[01;37mOK\033[00m"
117 endif
118
119 message:
120         @echo
121         @echo -e "\033[01;33m***\033[00;32m Building Apple2 SDL for $(MSG)...\033[00m"
122         @echo
123
124 clean:
125         @echo -en "\033[01;33m***\033[00;32m Cleaning out the garbage...\033[00m"
126         @rm -rf obj
127         @rm -f ./$(TARGET)$(EXESUFFIX)
128         @echo -e "\033[01;37mdone!\033[00m"
129
130 obj:
131         @mkdir obj
132
133 # This is only done for Win32 at the moment...
134
135 ifneq "" "$(ICON)"
136 $(ICON): res/$(TARGET).rc res/$(TARGET).ico
137         @echo -e "\033[01;33m***\033[00;32m Processing icon...\033[00m"
138         @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res
139 endif
140
141 obj/%.o: src/%.c
142         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
143         @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
144
145 obj/%.o: src/%.cpp
146         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
147         @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
148
149 #GUI compilation...
150 obj/%.o: src/gui/%.cpp
151         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
152         @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
153
154 $(TARGET)$(EXESUFFIX): $(OBJS)
155         @echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
156         @$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
157 #       strip --strip-all vj$(EXESUFFIX)
158 #       upx -9 vj$(EXESUFFIX)
159
160 # Pull in dependencies autogenerated by gcc's -MMD switch
161 # The "-" in front in there just in case they haven't been created yet
162
163 -include obj/*.d
164