2 # Makefile for Virtual Jaguar core library
6 # This software is licensed under the GPL v3 or any later version. See the
7 # file GPLv3 for details. ;-)
10 # Figure out which system we're compiling for, and set the appropriate variables
12 OSTYPE := $(shell uname -a)
14 ifeq "$(findstring Msys,$(OSTYPE))" "Msys" # Win32
16 SYSTYPE := __GCCWIN32__
19 else ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin" # Should catch both 'darwin' and 'darwin7.0'
21 SYSTYPE := __GCCUNIX__ -D_OSX_
22 SDLLIBTYPE := --static-libs
24 else ifeq "$(findstring Linux,$(OSTYPE))" "Linux" # Linux
26 SYSTYPE := __GCCUNIX__
31 $(error OS TYPE UNDETECTED)
35 # Set vars for libcdio
36 ifneq "$(shell pkg-config --silence-errors --libs libcdio)" ""
37 HAVECDIO := -DHAVE_LIB_CDIO
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)
87 # Targets for convenience sake, not "real" targets
90 all: obj obj/libjaguarcore.a
96 # Library rules (might not be cross-platform compatible)
97 obj/libjaguarcore.a: $(OBJS)
98 @$(AR) $(ARFLAGS) obj/libjaguarcore.a $(OBJS)
100 # Main source compilation (implicit rules)...
103 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
104 @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
107 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
108 @$(CC) $(CXXFLAGS) $(INCS) -c $< -o $@