]> Shamusworld >> Repos - virtualjaguar/blob - jaguarcore.mak
Merging qt-experimental into trunk.
[virtualjaguar] / jaguarcore.mak
1 #
2 # Makefile for Virtual Jaguar core library
3 #
4 # by James L. Hammons
5 #
6 # This software is licensed under the GPL v3 or any later version. See the
7 # file GPLv3 for details. ;-)
8 #
9
10 # Figure out which system we're compiling for, and set the appropriate variables
11
12 OSTYPE := $(shell uname -a)
13
14 ifeq "$(findstring Msys,$(OSTYPE))" "Msys"                      # Win32
15
16 SYSTYPE    := __GCCWIN32__
17 SDLLIBTYPE := --libs
18
19 else ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin"     # Should catch both 'darwin' and 'darwin7.0'
20
21 SYSTYPE    := __GCCUNIX__ -D_OSX_
22 SDLLIBTYPE := --static-libs
23
24 else ifeq "$(findstring Linux,$(OSTYPE))" "Linux"               # Linux
25
26 SYSTYPE    := __GCCUNIX__
27 SDLLIBTYPE := --libs
28
29 else                                                                                    # ???
30
31 $(error OS TYPE UNDETECTED)
32
33 endif
34
35 # Set vars for libcdio
36 ifneq "$(shell pkg-config --silence-errors --libs libcdio)" ""
37 HAVECDIO := -DHAVE_LIB_CDIO
38 CDIOLIB  := -lcdio
39 else
40 HAVECDIO :=
41 CDIOLIB  :=
42 endif
43
44 CC      := gcc
45 LD      := gcc
46 AR      := ar
47 ARFLAGS := -rs
48
49 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
50 CFLAGS  := -MMD -O2 -ffast-math -fomit-frame-pointer `sdl-config --cflags` -D$(SYSTYPE)
51 CXXFLAGS  := -MMD -O2 -ffast-math -fomit-frame-pointer `sdl-config --cflags` -D$(SYSTYPE)
52
53 INCS := -I./src
54
55 OBJS := \
56         obj/blitter.o      \
57         obj/cdintf.o       \
58         obj/cdrom.o        \
59         obj/crc32.o        \
60         obj/dac.o          \
61         obj/dsp.o          \
62         obj/eeprom.o       \
63         obj/event.o        \
64         obj/file.o         \
65         obj/filedb.o       \
66         obj/gpu.o          \
67         obj/jagdasm.o      \
68         obj/jaguar.o       \
69         obj/jerry.o        \
70         obj/joystick.o     \
71         obj/log.o          \
72         obj/memory.o       \
73         obj/mmu.o          \
74         obj/objectp.o      \
75         obj/settings.o     \
76         obj/state.o        \
77         obj/tom.o          \
78         obj/universalhdr.o \
79         obj/unzip.o        \
80         obj/wavetable.o
81
82 # Targets for convenience sake, not "real" targets
83 .PHONY: clean
84
85 all: obj obj/libjaguarcore.a
86         @echo "Done!"
87
88 obj:
89         @mkdir obj
90
91 # Library rules (might not be cross-platform compatible)
92 obj/libjaguarcore.a: $(OBJS) 
93         @$(AR) $(ARFLAGS) obj/libjaguarcore.a $(OBJS)
94
95 # Main source compilation (implicit rules)...
96
97 obj/%.o: src/%.c
98         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
99         @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
100
101 obj/%.o: src/%.cpp
102         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
103         @$(CC) $(CXXFLAGS) $(INCS) -c $< -o $@
104
105 -include obj/*.d