#!/usr/bin/make -f # ============================================================================== # ARMv5 (Brainux) Switchable Optimization Template # Please add this below `#!/usr/bin/make -f`. # ============================================================================== # ------------------------------------------------------------------------------ # [1] Basic flags (base optimizations applied even during test builds) # ------------------------------------------------------------------------------ export COMMON_APPEND = -march=armv5tej -mtune=arm926ej-s -marm -falign-functions=4 export COMMON_APPEND += -O3 -fomit-frame-pointer -fno-tree-vectorize export COMMON_APPEND += -mfloat-abi=soft -ffast-math -fno-finite-math-only -ffunction-sections -fdata-sections # Uncomment for legacy 2000s source code or when build/runtime issues occur. export COMMON_APPEND += -fno-strict-aliasing -fno-aggressive-loop-optimizations -fno-strict-overflow export COMMON_APPEND += export DEB_CXXFLAGS_MAINT_APPEND = $(COMMON_APPEND) -fpermissive MY_CFLGS_BASE = $(COMMON_APPEND) -Wno-error=implicit-function-declaration -Wno-error=int-conversion export DEB_LDFLAGS_MAINT_APPEND = -lm -Wl,--as-needed export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # [2] Ultra-powerful finalization flag (Resource-intensive; for LTO production use) # When performing a build check (test), # please comment out the six lines below by adding a "#" at the beginning of each. # When comment out, please execute the following command beforehand. # $ mkdir -p ~/target_tmp # ------------------------------------------------------------------------------ export TMPDIR =$(HOME)/target_tmp export TMP =$(HOME)/target_tmp export TEMP =$(HOME)/target_tmp export DEB_CXXFLAGS_MAINT_APPEND += -Wno-odr export DEB_LDFLAGS_MAINT_APPEND += -flto-partition=max export DEB_BUILD_MAINT_OPTIONS += optimize=+lto # ------------------------------------------------------------------------------ include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/pkg-info.mk # ============================================================================== # Please add this below `include /usr/share/dpkg/default.mk`. # ============================================================================== # ------------------------------------------------------------------------------ # [3] Final assignment (*Must be placed at the very end) # ------------------------------------------------------------------------------ export DEB_CFLAGS_MAINT_APPEND = $(MY_CFLGS_BASE) # ------------------------------------------------------------------------------ export DEB_CFLAGS_MAINT_APPEND += -std=gnu99 export DEB_CXXFLAGS_MAINT_APPEND += -std=gnu++98 -Wno-template-id-cdtor # ------------------------------------------------------------------------------ confflags = --disable-rpath --enable-sdl-dlopen \ --disable-assembly --enable-video-opengl --disable-video-x11-xrandr --disable-video-x11-xv --disable-nasm --enable-video-x11 --enable-video-fbcon --disable-video-dga --disable-video-directfb --enable-joystick --enable-cdrom \ --disable-video-ggi --disable-video-svga --disable-video-aalib \ --disable-nas --disable-esd --disable-arts \ --disable-alsa-shared --disable-pulseaudio-shared \ --disable-x11-shared \ --enable-video-caca # Only use NASM routines on x86 CPUs ifeq ($(DEB_HOST_ARCH_CPU),i386) confflags += --enable-nasm endif # Don't use PlayStation 3 Cell driver on powerpc and ppc64 ifneq (,$(findstring $(DEB_HOST_ARCH_CPU),powerpc ppc64)) confflags += --enable-video-ps3=no \ --disable-altivec endif %: dh $@ override_dh_autoreconf: # aclocal needs to include in specific order, and/or it seems that # doesn't try to find .m4 files in /usr/share/aclocal at all. Updates # to both .m4 files and ltmain.sh (aclocal and libtoolize) are necessary # to support new architectures aarch64 (arm64) and powerpc64le, and this # seems the more straight way to achieve it. # # An alternative would be to just build-depend on libesd0-dev, # libasound2-dev and libltdl-dev to provide the files "esd.m4 alsa.m4 # ltdl.m4" in /usr/share/aclocal, and not use the local "acinclude" dir # at all, but this pull even more dependencies, and unneeded ones. # # Another equivalent alternative, but more verbose: # # ACLOCAL="cat acinclude/esd.m4 acinclude/alsa.m4 acinclude/ltdl.m4 \ # /usr/share/aclocal/libtool.m4 \ # /usr/share/aclocal/ltoptions.m4 \ # /usr/share/aclocal/ltversion.m4 \ # /usr/share/aclocal/ltsugar.m4 >> aclocal.m4; aclocal" # LIBTOOLIZE="libtoolize -f -i" dh_autoreconf --as-needed # autoreconf -- -I acinclude -f -i AUTOHEADER=true ACLOCAL="aclocal --force --install -I /usr/share/aclocal/ -I acinclude" LIBTOOLIZE="libtoolize -fi" dh_autoreconf --as-needed # To verify that it worked, grep should find these strings: # #rgrep -i aarch64 . #rgrep -r powerpc64le . override_dh_auto_configure: dh_auto_configure -- $(confflags) override_dh_auto_build: dh_auto_build GZIP="-9n" tar czf debian/examples.tar.gz test --owner=0 --group=0 --mode=go=rX,u+rw,a-s --clamp-mtime --mtime="@$(SOURCE_DATE_EPOCH)" --sort=name override_dh_auto_clean: dh_auto_clean rm -f debian/examples.tar.gz override_dh_install: rm -f debian/tmp/usr/lib/*/libSDL*.la dh_install override_dh_installdocs: dh_installdocs -Xdocs/man3/SDL