From 905edaed62e2dcdcfca8f79245e9f19275d63298 Mon Sep 17 00:00:00 2001 From: Jamie Wilkinson Date: Wed, 17 Jul 2002 06:41:16 +0000 Subject: [PATCH] - Added compiler optimisations back to the Makefiles, courtesy of configure. Some basic optimisations are added unless optimisations are explicitly disabled. Extra optimisations are added based on the cpu being built on. --- configure.in | 25 +++++++++++++++++++++++++ src/Makefile.am | 2 +- src/baseq2/Makefile.am | 2 +- src/ctf/Makefile.am | 37 +++++++++---------------------------- src/rogue/Makefile.am | 4 ++-- src/xatrix/Makefile.am | 4 ++-- 6 files changed, 40 insertions(+), 34 deletions(-) diff --git a/configure.in b/configure.in index c378529..b3d8a0e 100644 --- a/configure.in +++ b/configure.in @@ -300,6 +300,31 @@ AC_SUBST(DL_LIBS) #SDL_FLAGS=`sdl-config --libs` #AC_SUBST(SDL_FLAGS) +dnl ------------------------- +dnl Optimising compiler flags +dnl ------------------------- + +OPT_CFLAGS="" +USE_OPT="" +AC_MSG_CHECKING(whether to allow compiler optimisations) +AC_ARG_ENABLE(opt, + [ --disable-opt disable compiler optimisations ], + AC_MSG_RESULT(optimisations disabled), + AC_MSG_RESULT(optimisations enabled) + USE_OPT="yes" + OPT_CFLAGS="$OPT_CFLAGS -O2 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations" +) +if test "x$USE_OPT" = "xyes"; then + case "${host}" in + i?86-*-*) + OPT_CFLAGS="$OPT_CFLAGS -malign-loops=2 -malign-jumps=2 -malign-functions=2" + ;; + *) + ;; + esac +fi +AC_SUBST(OPT_CFLAGS) + dnl ------------------- dnl Checks for asm junk dnl ------------------- diff --git a/src/Makefile.am b/src/Makefile.am index e5ea0e2..25503f7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = . baseq2 ctf xatrix rogue -std_cflags = -Wall -Werror -pipe +std_cflags = -Wall -Werror -pipe @OPT_CFLAGS@ module_ldflags = -module -avoid-version -rpath $(pkglibdir) bin_PROGRAMS = quake2 diff --git a/src/baseq2/Makefile.am b/src/baseq2/Makefile.am index 420d97e..75c4270 100644 --- a/src/baseq2/Makefile.am +++ b/src/baseq2/Makefile.am @@ -16,6 +16,6 @@ game_la_SOURCES = g_ai.c g_chase.c g_cmds.c g_svcmds.c g_combat.c \ p_client.c p_hud.c p_trail.c p_view.c p_weapon.c \ q_shared.c -AM_CFLAGS = -fPIC -Wall -Werror -pipe +AM_CFLAGS = -fPIC -Wall -Werror -pipe @OPT_CFLAGS@ AM_CPPFLAGS = -I.. LDFLAGS = -module -avoid-version -rpath $(pkglibdir) diff --git a/src/ctf/Makefile.am b/src/ctf/Makefile.am index d639402..a1cab5c 100644 --- a/src/ctf/Makefile.am +++ b/src/ctf/Makefile.am @@ -2,34 +2,15 @@ pkglibdir=$(libdir)/@PACKAGE@/ctf pkglib_LTLIBRARIES = game.la -game_la_SOURCES = \ - g_ai.c \ - g_chase.c \ - g_cmds.c \ - g_combat.c \ - g_ctf.c \ - g_func.c \ - g_items.c \ - g_main.c \ - g_misc.c \ - g_monster.c \ - g_phys.c \ - g_save.c \ - g_spawn.c \ - g_svcmds.c \ - g_target.c \ - g_trigger.c \ - g_utils.c \ - g_weapon.c \ - m_move.c \ - p_client.c \ - p_hud.c \ - p_menu.c \ - p_trail.c \ - p_view.c \ - p_weapon.c \ - q_shared.c +game_la_SOURCES = g_ai.c g_chase.c g_cmds.c g_combat.c g_ctf.c \ + g_func.c g_items.c g_main.c g_misc.c g_monster.c \ + g_phys.c g_save.c g_spawn.c g_svcmds.c g_target.c \ + g_trigger.c g_utils.c g_weapon.c \ + m_move.c \ + p_client.c p_hud.c p_menu.c p_trail.c p_view.c \ + p_weapon.c \ + q_shared.c -AM_CFLAGS = -fPIC -Wall -Werror -pipe +AM_CFLAGS = -fPIC -Wall -Werror -pipe @OPT_CFLAGS@ AM_CPPFLAGS = -I.. LDFLAGS = -module -avoid-version -rpath $(pkglibdir) diff --git a/src/rogue/Makefile.am b/src/rogue/Makefile.am index a8020e2..e0cceea 100644 --- a/src/rogue/Makefile.am +++ b/src/rogue/Makefile.am @@ -19,7 +19,7 @@ game_la_SOURCES = dm_ball.c dm_tag.c \ m_tank.c m_turret.c m_widow.c m_widow2.c \ p_client.c p_hud.c p_trail.c p_view.c p_weapon.c \ q_shared.c -#game_la_CFLAGS = -fPIC -Wall -Werror -pipe -game_la_CFLAGS = -I.. -fPIC -pipe +#game_la_CFLAGS = -fPIC -Wall -Werror -pipe @OPT_CFLAGS@ +game_la_CFLAGS = -I.. -fPIC -pipe @OPT_CFLAGS@ game_la_LDFLAGS = -module -avoid-version -rpath $(pkglibdir) endif # DO_ROGUE diff --git a/src/xatrix/Makefile.am b/src/xatrix/Makefile.am index 167fd5d..478a46d 100644 --- a/src/xatrix/Makefile.am +++ b/src/xatrix/Makefile.am @@ -16,7 +16,7 @@ game_la_SOURCES = g_ai.c g_chase.c g_cmds.c g_combat.c g_func.c \ m_parasite.c m_soldier.c m_supertank.c m_tank.c \ p_client.c p_hud.c p_trail.c p_view.c p_weapon.c \ q_shared.c -#game_la_CFLAGS = -fPIC -Wall -Werror -pipe -game_la_CFLAGS = -I.. -fPIC -pipe +#game_la_CFLAGS = -fPIC -Wall -Werror -pipe @OPT_CFLAGS@ +game_la_CFLAGS = -I.. -fPIC -pipe @OPT_CFLAGS@ game_la_LDFLAGS = -module -avoid-version -rpath $(pkglibdir) endif # DO_XATRIX