]> Shamusworld >> Repos - virtualjaguar/blob - jaguarcore.mak
Simplify platform detection in jaguarcore.mak
[virtualjaguar] / jaguarcore.mak
1 #
2 # Makefile for Virtual Jaguar core library
3 #
4 # by James 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 # Cross compilation with MXE
11 #CROSS = i686-pc-mingw32-
12
13 SYSTYPE    := __GCCUNIX__
14
15 ifneq "$(CROSS)" ""
16 SYSTYPE    := __GCCWIN32__
17 else
18 OSTYPE := $(shell uname -o)
19 ifeq "$(OSTYPE)" "Msys"
20 SYSTYPE    := __GCCWIN32__
21 endif
22 endif
23
24 # Set vars for libcdio
25 ifneq "$(shell pkg-config --silence-errors --libs libcdio)" ""
26 HAVECDIO := -DHAVE_LIB_CDIO
27 CDIOLIB  := -lcdio
28 else
29 HAVECDIO :=
30 CDIOLIB  :=
31 endif
32
33 CC      := $(CROSS)gcc
34 LD      := $(CROSS)gcc
35 AR      := $(CROSS)ar
36 ARFLAGS := -rs
37
38 SDL_CFLAGS = `$(CROSS)sdl-config --cflags`
39 DEFINES = -D$(SYSTYPE)
40 GCC_DEPS = -MMD
41
42 INCS := -I./src
43
44 OBJS := \
45         obj/blitter.o      \
46         obj/cdintf.o       \
47         obj/cdrom.o        \
48         obj/crc32.o        \
49         obj/dac.o          \
50         obj/dsp.o          \
51         obj/eeprom.o       \
52         obj/event.o        \
53         obj/file.o         \
54         obj/filedb.o       \
55         obj/gpu.o          \
56         obj/jagbios.o      \
57         obj/jagbios2.o     \
58         obj/jagcdbios.o    \
59         obj/jagdevcdbios.o \
60         obj/jagstub1bios.o \
61         obj/jagstub2bios.o \
62         obj/jagdasm.o      \
63         obj/jaguar.o       \
64         obj/jerry.o        \
65         obj/joystick.o     \
66         obj/log.o          \
67         obj/memory.o       \
68         obj/mmu.o          \
69         obj/op.o           \
70         obj/settings.o     \
71         obj/state.o        \
72         obj/tom.o          \
73         obj/universalhdr.o \
74         obj/unzip.o        \
75         obj/wavetable.o
76
77 # Targets for convenience sake, not "real" targets
78 .PHONY: clean
79
80 all: obj obj/libjaguarcore.a
81         @echo "Done!"
82
83 obj:
84         @mkdir obj
85
86 # Library rules (might not be cross-platform compatible)
87 obj/libjaguarcore.a: $(OBJS) 
88         @$(AR) $(ARFLAGS) obj/libjaguarcore.a $(OBJS)
89
90 # Main source compilation (implicit rules)...
91
92 obj/%.o: src/%.cpp
93         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
94         @$(CC) $(GCC_DEPS) $(CXXFLAGS) $(SDL_CFLAGS) $(DEFINES) $(INCS) -c $< -o $@
95
96 -include obj/*.d