[mupen64plus-ui-console] 60/172: Rewrite Makefile to fix flags and linking

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:07:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-ui-console.

commit c5a291d50740b0c810f7d295e17c5f0ec9fd73dd
Author: Sven Eckelmann <sven at narfation.org>
Date:   Sat Jul 23 17:47:58 2011 +0200

    Rewrite Makefile to fix flags and linking
---
 debian/changelog                           |   3 +
 debian/patches/default-optimisations.patch |  39 ------
 debian/patches/rewrite_makefile.patch      | 200 +++++++++++++++++++++++++++++
 debian/patches/series                      |   2 +-
 debian/rules                               |   2 +-
 5 files changed, 205 insertions(+), 41 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 283553c..3830ee2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
 mupen64plus-ui-console (1.99.4-4) UNRELEASED; urgency=low
 
   * Mark all targets in debian/rules as phony
+  * debian/patches:
+    - Remove obsolete default-optimisations.patch
+    - Add rewrite_makefile.patch, Rewrite Makefile to fix flags and linking
 
  -- Sven Eckelmann <sven at narfation.org>  Sat, 23 Jul 2011 16:42:52 +0200
 
diff --git a/debian/patches/default-optimisations.patch b/debian/patches/default-optimisations.patch
deleted file mode 100644
index 526b578..0000000
--- a/debian/patches/default-optimisations.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Description: Don't override optimisations set by build environment
-Forwarded: not-needed
-Author: Sven Eckelmann <sven at narfation.org>
-
----
-diff --git a/projects/unix/Makefile b/projects/unix/Makefile
-index 0d4e5f641b19ce31d2dc295025df2afbaecb9041..b8ab1995a988e5e0518ff6a9ec20918e09bc98da 100644
---- a/projects/unix/Makefile
-+++ b/projects/unix/Makefile
-@@ -76,16 +76,16 @@ endif
- 
- # base CFLAGS, LIBS, and LDFLAGS
- CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -I../../src
--LDFLAGS += -lpthread
-+LDFLAGS += 
- 
- # set special flags per-system
- ifeq ($(OS), LINUX)
-   ifeq ($(CPU), X86)
-     ifeq ($(ARCH_DETECTED), 64BITS)
--      CFLAGS += -pipe -O3 -march=athlon64
-+      CFLAGS += -pipe
-       LDFLAGS += -ldl
-     else
--      CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
-+      CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer
-       LDFLAGS += -ldl
-     endif
-   endif
-@@ -103,9 +103,6 @@ ifeq ($(OS), OSX)
-     endif
-   endif
- endif
--ifeq ($(CPU), PPC)
--  CFLAGS += -mcpu=powerpc
--endif
- 
- # tweak flags for 32-bit build on 64-bit system
- ifeq ($(ARCH_DETECTED), 64BITS_32)
diff --git a/debian/patches/rewrite_makefile.patch b/debian/patches/rewrite_makefile.patch
new file mode 100644
index 0000000..e985946
--- /dev/null
+++ b/debian/patches/rewrite_makefile.patch
@@ -0,0 +1,200 @@
+Description: Rewrite Makefile to fix flags and linking
+Author: Sven Eckelmann <sven at narfation.org>
+
+---
+diff --git a/projects/unix/Makefile b/projects/unix/Makefile
+index 0d4e5f641b19ce31d2dc295025df2afbaecb9041..00afe887ed9c30ea09ed2cf9e285e300a5840ad4 100644
+--- a/projects/unix/Makefile
++++ b/projects/unix/Makefile
+@@ -38,6 +38,10 @@ endif
+ ifeq ("$(UNAME)","FreeBSD")
+   OS = FREEBSD
+ endif
++ifeq ("$(UNAME)","OpenBSD")
++  OS = FREEBSD
++  $(warning OS type "$(UNAME)" not officially supported.')
++endif
+ ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
+   OS = LINUX
+ endif
+@@ -74,25 +78,23 @@ ifeq ("$(CPU)","NONE")
+   $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
+ endif
+ 
+-# base CFLAGS, LIBS, and LDFLAGS
+-CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -I../../src
+-LDFLAGS += -lpthread
++# base CFLAGS, LDLIBS, and LDFLAGS
++OPTFLAGS ?= -O3
++CFLAGS += $(OPTFLAGS) -ffast-math -fno-strict-aliasing -pthread -I../../src
++LDLIBS += -pthread
++
++ifeq ($(PIE), 1)
++  CFLAGS += -fPIE
++  LDFLAGS += -fPIE -pie
++endif
+ 
+ # set special flags per-system
+ ifeq ($(OS), LINUX)
+-  ifeq ($(CPU), X86)
+-    ifeq ($(ARCH_DETECTED), 64BITS)
+-      CFLAGS += -pipe -O3 -march=athlon64
+-      LDFLAGS += -ldl
+-    else
+-      CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
+-      LDFLAGS += -ldl
+-    endif
+-  endif
++  LDLIBS += -ldl
+ endif
+ ifeq ($(OS), OSX)
+   # The mac version of SDL requires inclusion of SDL_main in the executable
+-  LDFLAGS += -ldl $(shell sdl-config --libs)
++  LDLIBS += -ldl $(shell sdl-config --libs)
+   ifeq ($(CPU), X86)
+     ifeq ($(ARCH_DETECTED), 64BITS)
+       CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
+@@ -103,9 +105,6 @@ ifeq ($(OS), OSX)
+     endif
+   endif
+ endif
+-ifeq ($(CPU), PPC)
+-  CFLAGS += -mcpu=powerpc
+-endif
+ 
+ # tweak flags for 32-bit build on 64-bit system
+ ifeq ($(ARCH_DETECTED), 64BITS_32)
+@@ -113,7 +112,7 @@ ifeq ($(ARCH_DETECTED), 64BITS_32)
+     $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
+   endif
+   CFLAGS += -m32
+-  LDFLAGS += -m32 -m elf_i386
++  LDFLAGS += -m32 -Wl,-m,elf_i386
+ endif
+ 
+ # set mupen64plus core API header path
+@@ -138,15 +137,22 @@ else
+   endif
+ endif
+ 
+-# set shell function names
+-CC      ?= gcc
+-CXX     ?= g++
+-INSTALL ?= install
+-ifeq ($(OS),OSX)
+-  STRIP	?= strip -x 
+-else
+-  STRIP	?= strip -s
++# reduced compile output when running make without V=1
++ifneq ($(findstring $(MAKEFLAGS),s),s)
++ifndef V
++	Q_CC  = @echo '    CC  '$@;
++	Q_LD  = @echo '    LD  '$@;
+ endif
++endif
++
++# set base program pointers and flags
++CC       ?= gcc
++CXX      ?= g++
++RM       ?= rm -f
++INSTALL  ?= install
++MKDIR ?= mkdir -p
++COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
++LINK.o = $(Q_LD)$(CC) $(LDFLAGS) $(TARGET_ARCH)
+ 
+ # set special flags for given Makefile parameters
+ # note: COREDIR _must_ end in a slash if you want it to work; not necessary for the others
+@@ -161,7 +167,9 @@ ifneq ($(SHAREDIR),)
+ endif
+ ifeq ($(DEBUG),1)
+   CFLAGS += -g
+-  STRIP = true # disable binary strip
++  INSTALL_STRIP_FLAG ?= 
++else
++  INSTALL_STRIP_FLAG ?= -s
+ endif
+ 
+ # set installation options
+@@ -172,7 +180,7 @@ ifeq ($(BINDIR),)
+   BINDIR := $(PREFIX)/bin
+ endif
+ ifeq ($(MANDIR),)
+-  MANDIR := $(PREFIX)/man/man6
++  MANDIR := $(PREFIX)/share/man
+ endif
+ 
+ SRCDIR = ../../src
+@@ -191,7 +199,7 @@ SOURCE = \
+ # generate a list of object files build, make a temporary directory for them
+ OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
+ OBJDIRS = $(dir $(OBJECTS))
+-$(shell mkdir -p $(OBJDIRS))
++$(shell $(MKDIR) $(OBJDIRS))
+ 
+ # build targets
+ TARGET = mupen64plus
+@@ -209,47 +217,42 @@ targets:
+ 	@echo "    PLUGINDIR=path == default path to search for plugins"
+ 	@echo "    SHAREDIR=path  == default path to search for shared data files"
+ 	@echo "    APIDIR=path    == path to find Mupen64Plus Core headers"
++	@echo "    OPTFLAGS=flags == compiler optimization (default: -O3)"
++	@echo "    PIE=(1|0)      == Force enable/disable of position independent executables"
+ 	@echo "  Install Options:"
+ 	@echo "    PREFIX=path    == install/uninstall prefix (default: /usr/local/)"
+ 	@echo "    BINDIR=path    == path to install mupen64plus binary (default: PREFIX/bin/)"
+-	@echo "    MANDIR=path    == path to install mupen64plus manual page (default: PREFIX/man/man6/)"
++	@echo "    MANDIR=path    == path to install mupen64plus manual page (default: PREFIX/share/man)"
+ 	@echo "    DESTDIR=path   == path to prepend to all installation paths (only for packagers)"
+ 	@echo "  Debugging Options:"
+ 	@echo "    DEBUG=1        == add debugging symbols to application binary"
++	@echo "    V=1            == show verbose compiler output"
+ 
+ all: $(TARGET)
+ 
+ clean:
+-	rm -rf ./_obj/* $(TARGET)
+-	rmdir ./_obj
++	$(RM) -r ./_obj $(TARGET)
+ 
+ rebuild: clean all
+ 
+ install: $(TARGET)
+-	$(INSTALL) -d -v "$(DESTDIR)$(BINDIR)"
+-	$(INSTALL) -m 0755 $(TARGET) "$(DESTDIR)$(BINDIR)"
+-	$(INSTALL) -d -v "$(DESTDIR)$(MANDIR)"
+-	$(INSTALL) -m 0644 ../../doc/mupen64plus.6.gz "$(DESTDIR)$(MANDIR)"
++	$(INSTALL) -d "$(DESTDIR)$(BINDIR)"
++	$(INSTALL) -m 0755 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(BINDIR)"
++	$(INSTALL) -d "$(DESTDIR)$(MANDIR)/man6"
++	$(INSTALL) -m 0644 ../../doc/mupen64plus.6.gz "$(DESTDIR)$(MANDIR)/man6"
+ 
+ uninstall:
+-	rm -f "$(DESTDIR)$(BINDIR)/$(TARGET)" "$(DESTDIR)$(MANDIR)/mupen64plus.6.gz"
++	$(RM) "$(DESTDIR)$(BINDIR)/$(TARGET)" "$(DESTDIR)$(MANDIR)/man6/mupen64plus.6.gz"
+ 
+ # build dependency files
+ CFLAGS += -MD
+ -include $(OBJECTS:.o=.d)
+ 
+-# reduced compile output when running make without V=1
+-ifneq ($(findstring $(MAKEFLAGS),s),s)
+-ifndef V
+-	Q_CC  = @echo '    CC  '$@;
+-	Q_LD  = @echo '    LD  '$@;
+-endif
+-endif
+-
+-# build rules
+-$(TARGET): $(OBJECTS)
+-	$(Q_LD)$(CC) $^ $(LDFLAGS) $(SRC_LIBS) -o $@
+-	$(STRIP) $@
+-
++# standard build rules
+ $(OBJDIR)/%.o: $(SRCDIR)/%.c
+-	$(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
++	$(COMPILE.c) -o $@ $<
++
++$(TARGET): $(OBJECTS)
++	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
++
++.PHONY: all clean install uninstall targets
diff --git a/debian/patches/series b/debian/patches/series
index e164d80..c753e70 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-default-optimisations.patch
+rewrite_makefile.patch
diff --git a/debian/rules b/debian/rules
index 02559bf..70dd1f1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,7 +17,7 @@ LDFLAGS += -Wl,--as-needed
 
 DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
 DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
-MAKEOPTIONS = V=1 UNAME='$(DEB_HOST_ARCH_OS)' HOST_CPU='$(DEB_HOST_GNU_CPU)' APIDIR=/usr/include/mupen64plus/ DEBUG=1 PREFIX=/usr/ COREDIR="/usr/lib/$(DEB_HOST_MULTIARCH)/" PLUGINDIR="/usr/lib/$(DEB_HOST_MULTIARCH)/mupen64plus" MANDIR=/usr/share/man/man6/ BINDIR=/usr/games/
+MAKEOPTIONS = V=1 UNAME='$(DEB_HOST_ARCH_OS)' HOST_CPU='$(DEB_HOST_GNU_CPU)' APIDIR=/usr/include/mupen64plus/ DEBUG=1 PREFIX=/usr/ COREDIR="/usr/lib/$(DEB_HOST_MULTIARCH)/" PLUGINDIR="/usr/lib/$(DEB_HOST_MULTIARCH)/mupen64plus" MANDIR=/usr/share/man/ BINDIR=/usr/games/
 
 binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep %:
 	dh $@ --sourcedirectory="projects/unix" --parallel --list-missing

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-ui-console.git



More information about the Pkg-games-commits mailing list