commit 938cfdf1f01bcc9ac736249ee6458a774d560738 Author: hasufell Date: Tue Jun 25 23:48:02 2013 +0200 QA: respect several environment variables such as CC,CFLAGS,PKG_CONFIG... --- a/makefile 2014-01-26 03:32:25.668229038 +0100 +++ b/makefile 2014-01-26 03:52:22.667290791 +0100 @@ -330,14 +330,16 @@ # compiler, linker and utilities ifneq ($(TARGETOS),emscripten) -AR = @ar -CC = @gcc -LD = @g++ +AR ?= @ar +CC ?= @gcc +CXX ?= @g++ +LD = $(CXX) endif MD = -mkdir$(EXE) RM = @rm -f OBJDUMP = @objdump -PYTHON = @python +PYTHON ?= @python +PKG_CONFIG ?= pkg-config #------------------------------------------------- @@ -480,7 +482,7 @@ # CFLAGS is defined based on C or C++ targets # (remember, expansion only happens when used, so doing it here is ok) -CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS) +CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS) # we compile C-only to C89 standard with GNU extensions # we compile C++ code to C++98 standard with GNU extensions @@ -488,9 +490,6 @@ CPPONLYFLAGS += -x c++ -std=gnu++98 COBJFLAGS += -x objective-c++ -# this speeds it up a bit by piping between the preprocessor/compiler/assembler -CCOMFLAGS += -pipe - # add -g if we need symbols, and ensure we have frame pointers ifdef SYMBOLS CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer @@ -512,22 +511,6 @@ CCOMFLAGS += -pg endif -# add the optimization flag -CCOMFLAGS += -O$(OPTIMIZE) - -# add the error warning flag -ifndef NOWERROR -CCOMFLAGS += -Werror -endif - -# if we are optimizing, include optimization options -ifneq ($(OPTIMIZE),0) -CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS) -ifdef LTO -CCOMFLAGS += -flto -endif -endif - # add a basic set of warnings CCOMFLAGS += \ -Wall \ @@ -613,30 +596,11 @@ # linking flags #------------------------------------------------- -# LDFLAGS are used generally; LDFLAGSEMULATOR are additional -# flags only used when linking the core emulator -LDFLAGS = -ifneq ($(TARGETOS),macosx) -ifneq ($(TARGETOS),os2) -ifneq ($(TARGETOS),solaris) -LDFLAGS = -Wl,--warn-common -endif -endif -endif -LDFLAGSEMULATOR = - # add profiling information for the linker ifdef PROFILE LDFLAGS += -pg endif -# strip symbols and other metadata in non-symbols and non profiling builds -ifndef SYMBOLS -ifneq ($(TARGETOS),macosx) -LDFLAGS += -s -endif -endif - ifneq ($(OPTIMIZE),0) ifdef LTO LDFLAGS += -flto --- a/src/osd/sdl/sdl.mak +++ b/src/osd/sdl/sdl.mak @@ -24,6 +24,8 @@ # uncomment and edit next line to specify a distribution # supported debian-stable, ubuntu-intrepid +PKG_CONFIG ?= pkg-config + # DISTRO = debian-stable # DISTRO = ubuntu-intrepid # DISTRO = gcc44-generic @@ -89,9 +89,9 @@ SDL_LIBVER = sdl endif ifdef SDL_INSTALL_ROOT -SDL_CONFIG = $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config +SDL_CONFIG ?= $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config else -SDL_CONFIG = $(SDL_LIBVER)-config +SDL_CONFIG ?= $(SDL_LIBVER)-config endif ifeq ($(SDL_LIBVER),sdl2) @@ -188,8 +188,8 @@ SYNC_IMPLEMENTATION = tc SDL_NETWORK = taptun ifndef NO_USE_MIDI -INCPATH += `pkg-config --cflags alsa` -LIBS += `pkg-config --libs alsa` +INCPATH += $(shell $(PKG_CONFIG) --cflags alsa) +LIBS += $(shell $(PKG_CONFIG) --libs alsa) endif endif @@ -497,13 +497,12 @@ # Compile using installed libSDL (Fink or MacPorts): # # Remove the "/SDL" component from the include path so that we can compile - # files (header files are #include "SDL/something.h", so the extra "/SDL" # causes a significant problem) -INCPATH += `sdl-config --cflags | sed 's:/SDL::'` +INCPATH += $(shell $(SDL_CONFIG) --cflags | sed 's:/SDL::') CCOMFLAGS += -DNO_SDL_GLEXT # Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m -LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread +LIBS += $(shell $(SDL_CONFIG) --libs | sed 's/-lSDLmain//') -lpthread DEFS += -DMACOSX_USE_LIBSDL endif # MACOSX_USE_LIBSDL @@ -558,9 +558,9 @@ endif ifneq ($(TARGETOS),emscripten) -INCPATH += `pkg-config --cflags fontconfig` +INCPATH += $(shell $(PKG_CONFIG) --cflags fontconfig) endif -LIBS += `pkg-config --libs fontconfig` +LIBS += $(shell $(PKG_CONFIG) --libs fontconfig) ifeq ($(SDL_LIBVER),sdl2) #LIBS += -lSDL2_ttf @@ -647,8 +647,8 @@ ifeq ($(BASE_TARGETOS),os2) -INCPATH += `sdl-config --cflags` -LIBS += `sdl-config --libs` -lpthread +INCPATH += $(shell $(SDL_CONFIG) --cflags) +LIBS += $(shell $(SDL_CONFIG) --libs) endif # OS2 @@ -657,10 +657,14 @@ #------------------------------------------------- ifndef NO_USE_QTDEBUG -$(SDLOBJ)/%.moc.c: $(SDLSRC)/%.h - $(MOC) $(MOCINCPATH) $(DEFS) $< -o $@ -DEBUGOBJS = \ +INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags) +LIBS += $(shell $(PKG_CONFIG) QtGui --libs) + +#$(SDLOBJ)/%.moc.c: $(SDLSRC)/%.h +# $(MOC) $(MOCINCPATH) $(DEFS) $< -o $@ + +#DEBUGOBJS = \ $(SDLOBJ)/debugqt.o \ $(SDLOBJ)/debugqtview.o \ $(SDLOBJ)/debugqtwindow.o \