]> Shamusworld >> Repos - stargem2/blob - Makefile
Moving to trunk...
[stargem2] / Makefile
1 #
2 # Makefile for StarGem 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 ifeq "$(OSTYPE)" "msys"                                                 # Win32
10
11 SYSTYPE    = __GCCWIN32__
12 EXESUFFIX  = .exe
13 GLLIB      = -lopengl32
14 ICON       = obj/icon.o
15 SDLLIBTYPE = --libs
16 MSG        = Win32 on MinGW
17
18 else
19 #ifeq "$(OSTYPE)" "darwin"
20 ifeq "darwin" "$(findstring darwin,$(OSTYPE))"  # Should catch both 'darwin' and 'darwin7.0'
21
22 SYSTYPE    = __GCCUNIX__ -D_OSX_
23 EXESUFFIX  =
24 GLLIB      =
25 ICON       =
26 SDLLIBTYPE = --static-libs
27 MSG        = Mac OS X
28
29 else                                                                                    # *nix
30
31 SYSTYPE    = __GCCUNIX__
32 EXESUFFIX  =
33 GLLIB      = -lGL
34 ICON       =
35 SDLLIBTYPE = --libs
36 MSG        = generic Unix/Linux
37
38 endif
39 endif
40
41 CC         = gcc
42 LD         = gcc
43 TARGET     = stargem2
44
45 CFLAGS   = -MMD -Wall -Wno-switch -Wno-uninitialized -O2 -D$(SYSTYPE) -fomit-frame-pointer `sdl-config --cflags`
46 CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -Wno-uninitialized -O2 -D$(SYSTYPE) \
47                 -fomit-frame-pointer `sdl-config --cflags`
48 #               -fomit-frame-pointer `sdl-config --cflags` -g
49 #               -fomit-frame-pointer `sdl-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES
50
51 LDFLAGS =
52
53 LIBS = -L/usr/local/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB)
54
55 INCS = -I. -Isrc -I/usr/local/include
56
57 #THECC = $(CC) $(CFLAGS) $(INCS)
58
59 OBJS = \
60         obj/dis6808.o       \
61         obj/dis6809.o       \
62         obj/log.o           \
63         obj/v6808.o         \
64         obj/v6809.o         \
65         obj/video.o         \
66         obj/settings.o      \
67         obj/sound.o         \
68         obj/sdlemu_config.o \
69         obj/sdlemu_opengl.o \
70         obj/timing.o        \
71         obj/stargem2.o      \
72         $(ICON)
73
74 all: checkenv message obj $(TARGET)$(EXESUFFIX)
75         @echo
76         @echo "*** Looks like it compiled OK... Give it a whirl!"
77
78 # Check the compilation environment, barf if not appropriate
79
80 checkenv:
81         @echo
82         @echo -n "*** Checking compilation environment... "
83 ifeq "" "$(shell which sdl-config)"
84         @echo
85         @echo
86         @echo "It seems that you don't have the SDL development libraries installed. If you"
87         @echo "have installed them, make sure that the sdl-config file is somewhere in your"
88         @echo "path and is executable."
89         @echo
90 #Is there a better way to break out of the makefile?
91         @break
92 else
93         @echo "OK"
94 endif
95
96 message:
97         @echo
98         @echo "*** Building StarGem 2 for $(MSG)..."
99         @echo
100
101 clean:
102         @echo -n "*** Cleaning out the garbage..."
103         @rm -rf obj
104         @rm -f ./$(TARGET)$(EXESUFFIX)
105         @echo "done!"
106
107 obj:
108         @mkdir obj
109
110 # This is only done for Win32 at the moment...
111
112 ifneq "" "$(ICON)"
113 $(ICON): res/$(TARGET).rc res/$(TARGET).ico
114         @echo "*** Processing icon..."
115         @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res
116 endif
117
118 obj/%.o: src/%.c
119         @echo "*** Compiling $<..."
120         @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
121
122 obj/%.o: src/%.cpp
123         @echo "*** Compiling $<..."
124         @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
125
126 $(TARGET)$(EXESUFFIX): $(OBJS)
127         @echo "*** Linking it all together..."
128         @$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
129 #       strip --strip-all $(TARGET)$(EXESUFFIX)
130 #       upx -9 $(TARGET)$(EXESUFFIX)
131
132 # Pull in dependencies autogenerated by gcc's -MMD switch
133 # The "-" in front in there just in case they haven't been created yet
134
135 -include obj/*.d