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