X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Makefile;h=895a0ab29e1202d029c61ca6e8dbb65e8ac47e6e;hb=b79e71ad6d2f71a2c1ccacb3d37ff02be60f2538;hp=c191bf480cdfa01ba3dc98ae025c1fd4e30bb00d;hpb=85fb2fe5f5a002a261e6b873b8393e085990a700;p=virtualjaguar diff --git a/Makefile b/Makefile index c191bf4..895a0ab 100644 --- a/Makefile +++ b/Makefile @@ -8,63 +8,72 @@ # # NOTE: zlib and OpenGL libs are a dependency, but are not checked for. -# same goes for libcdio +# same goes for libcdio, Qt # Figure out which system we're compiling for, and set the appropriate variables -ifeq "$(OSTYPE)" "msys" # Win32 +OSTYPE := $(shell uname -a) -SYSTYPE = __GCCWIN32__ -EXESUFFIX = .exe -GLLIB = -lopengl32 -ICON = obj/icon.o -SDLLIBTYPE = --libs -MSG = Win32 on MinGW +ifeq "$(findstring Msys,$(OSTYPE))" "Msys" # Win32 -else -#ifeq "$(OSTYPE)" "darwin" -ifeq "darwin" "$(findstring darwin,$(OSTYPE))" # Should catch both 'darwin' and 'darwin7.0' +SYSTYPE := __GCCWIN32__ +EXESUFFIX := .exe +GLLIB := -lopengl32 +ICON := obj/icon.o +SDLLIBTYPE := --libs +MSG := Win32 on MinGW + +else ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin" # Should catch both 'darwin' and 'darwin7.0' + +SYSTYPE := __GCCUNIX__ -D_OSX_ +EXESUFFIX := +GLLIB := +ICON := +SDLLIBTYPE := --static-libs +MSG := Mac OS X -SYSTYPE = __GCCUNIX__ -D_OSX_ -EXESUFFIX = -GLLIB = -ICON = -SDLLIBTYPE = --static-libs -MSG = Mac OS X +else ifeq "$(findstring Linux,$(OSTYPE))" "Linux" # Linux + +SYSTYPE := __GCCUNIX__ +EXESUFFIX := +GLLIB := -lGL -lGLU +ICON := +SDLLIBTYPE := --libs +MSG := GNU/Linux else # *nix -SYSTYPE = __GCCUNIX__ -EXESUFFIX = -GLLIB = -lGL -lGLU -ICON = -SDLLIBTYPE = --libs -MSG = generic Unix/Linux +$(error OS TYPE UNDETECTED) endif + +# Set vars for libcdio +ifneq "$(shell pkg-config --silence-errors --libs libcdio)" "" +HAVECDIO := -DHAVE_LIB_CDIO +CDIOLIB := -lcdio +else +HAVECDIO := +CDIOLIB := endif -CC = gcc -LD = gcc -TARGET = virtualjaguar +CC := gcc +LD := gcc +TARGET := virtualjaguar # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2 -CFLAGS = -MMD -Wall -Wno-switch -O2 -D$(SYSTYPE) -ffast-math -fomit-frame-pointer `sdl-config --cflags` -CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -O2 -D$(SYSTYPE) -Wno-trigraphs \ - -DHAVE_LIB_CDIO -ffast-math -fomit-frame-pointer `sdl-config --cflags` -g +CFLAGS := -MMD -Wall -Wno-switch -O2 -D$(SYSTYPE) -ffast-math -fomit-frame-pointer `sdl-config --cflags` +CPPFLAGS := -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -O2 -D$(SYSTYPE) -Wno-trigraphs \ + $(HAVECDIO) -ffast-math -fomit-frame-pointer `sdl-config --cflags` -g # -fomit-frame-pointer `sdl-config --cflags` -g # -fomit-frame-pointer `sdl-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES -LDFLAGS = +LDFLAGS := -LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -lcdio `pkg-config --libs QtGui QtOpenGL` -# Comment out the above and uncomment below if you don't have libcdio. -# Also, remove the "-DHAVE_LIB_CDIO" from CPPFLAGS above. -#LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) +LIBS := -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) $(CDIOLIB) `pkg-config --libs QtGui QtOpenGL` -INCS = -I. -I./src -I./src/gui -I/usr/local/include -I/usr/include +INCS := -I. -I./src -I./src/gui -I/usr/local/include -I/usr/include -OBJS = \ +OBJS := \ obj/m68kcpu.o \ obj/m68kops.o \ obj/m68kopac.o \ @@ -117,30 +126,81 @@ OBJS = \ obj/wavetable.o \ $(ICON) -all: checkenv message obj $(TARGET)$(EXESUFFIX) +# Targets for convenience sake, not "real" targets +.PHONY: clean + +all: checkenv message2 obj $(TARGET)$(EXESUFFIX) @echo @echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m" # Check the compilation environment, barf if not appropriate -checkenv: - @echo - @echo -en "\033[01;33m***\033[00;32m Checking compilation environment... \033[00m" -ifeq "" "$(shell which sdl-config)" - @echo +checkenv: msg-check-env check-sdl check-zlib check-cdio check-gl check-qt ; + +#check-sdl: msg-ck-sdl $(if $(strip ),,msg-no-sdl stop-on-error) +check-sdl: msg-ck-sdl $(if $(shell which sdl-config),,msg-no-sdl stop-on-error) + @echo -e "\033[01;37mOK\033[00m" + +msg-ck-sdl: + @echo -en " \033[00;32mSDL... \033[00m" + +msg-no-sdl: + @echo -e "\033[01;37mNOT FOUND\033[00m" @echo @echo -e "\033[01;33mIt seems that you don't have the SDL development libraries installed. If you" @echo -e "have installed them, make sure that the sdl-config file is somewhere in your" @echo -e "path and is executable.\033[00m" @echo -#Is there a better way to break out of the makefile? - @breaky -else + +check-zlib: msg-ck-zlib $(if $(shell pkg-config --silence-errors --libs zlib),,msg-no-zlib stop-on-error) @echo -e "\033[01;37mOK\033[00m" -endif -# !!! NOTE !!! Need to put a check here for libcdio, GL, zlib, Qt -message: +msg-ck-zlib: + @echo -en " \033[00;32mZLIB... \033[00m" + +msg-no-zlib: + @echo -e "\033[01;37mNOT FOUND\033[00m" + @echo + @echo -e "\033[01;33mIt seems that you don't have ZLIB installed. If you have installed it, make" + @echo -e "sure that the pkg-config file is somewhere in your path and is executable.\033[00m" + @echo + +#NOTE that this check shouldn't be fatal, we can bounce back from it by excluding CD support +check-cdio: msg-ck-cdio $(if $(CDIOLIB),msg-cdio,msg-no-cdio) ; + +msg-ck-cdio: + @echo -en " \033[00;32mLIBCDIO... \033[00m" + +msg-cdio: + @echo -e "\033[01;37mOK\033[00m" + +msg-no-cdio: + @echo -e "\033[01;37mNOT FOUND\033[00m" + @echo + @echo -e "\033[01;33mIt seems that you don't have LIBCDIO installed. Since this is not fatal," + @echo -e "Virtual Jaguar will be built WITHOUT CD support.\033[00m" + @echo + +check-gl: msg-ck-gl + @echo -e "*** GL CHECK NOT IMPLEMENTED ***" + +msg-ck-gl: + @echo -en " \033[00;32mOpenGL... \033[00m" + +check-qt: msg-ck-qt + @echo -e "*** QT CHECK NOT IMPLEMENTED ***" + +msg-ck-qt: + @echo -en " \033[00;32mQt... \033[00m" + +stop-on-error: ; $(error COMPILATION ENVIRONMENT) + +msg-check-env: + @echo + @echo -e "\033[01;33m***\033[00;32m Checking compilation environment: \033[00m" + @echo + +message2: @echo @echo -e "\033[01;33m***\033[00;32m Building Virtual Jaguar for $(MSG)...\033[00m" @echo @@ -163,7 +223,7 @@ $(ICON): res/$(TARGET).rc res/$(TARGET).ico @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res endif -# Main source compilation... +# Main source compilation (implicit rules)... obj/%.o: src/%.c @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m" @@ -204,7 +264,7 @@ QT_CFLAGS = -MMD `pkg-config --cflags QtGui` #QT_DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED QT_DEFINES = -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED #QT_INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I./src/gui -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I./obj -QT_INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I./src -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I/usr/X11R6/include -I./obj +QT_INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I./src -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I/usr/X11R6/include -I./obj `sdl-config --cflags` QT_CXXFLAGS = -MMD -pipe -O2 -march=pentium-m -pipe -D_REENTRANT -Wall -W $(QT_DEFINES) -D$(SYSTYPE) -g obj/moc_%.cpp: src/gui/%.h @@ -216,7 +276,7 @@ obj/moc_%.o: obj/moc_%.cpp @$(CC) -c $(QT_CXXFLAGS) $(QT_INCPATH) -o $@ $< obj/qrc_virtualjaguar.cpp: src/gui/virtualjaguar.qrc res/vj.xpm - @echo -e "\033[01;33m***\033[00;32m Creating qrc_vj.cpp...\033[00m" + @echo -e "\033[01;33m***\033[00;32m Creating qrc_virtualjaguar.cpp...\033[00m" @/usr/bin/rcc -name virtualjaguar src/gui/virtualjaguar.qrc -o obj/qrc_virtualjaguar.cpp obj/qrc_%.o: obj/qrc_%.cpp