From 64b608b20d577051a26d14a9ac54d2d39083f376 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 7 Aug 2002 18:20:23 +0000 Subject: [PATCH] put *sys_sdl.c into a lib so it doesn't get compiled more than once and do more macroizing --- acinclude.m4 | 21 ++++++++++ configure.ac | 97 ++++++++++++++++--------------------------- nq/source/Makefile.am | 42 ++++++++++--------- qw/source/Makefile.am | 38 ++++++++--------- 4 files changed, 98 insertions(+), 100 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 5833296d2..60d32f3da 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1114,3 +1114,24 @@ AC_SUBST($1_INCS) AC_SUBST($1_DEPS) AC_SUBST($1_LIBS) ]) + +AC_DEFUN(QF_NEED, [ +for qfn_lib in $2; do + eval "$1_need_$qfn_lib=yes" +done +]) + +AC_DEFUN(QF_PROCESS_NEED, [ +if test -n "$3"; then + qfn_ext="$3" +else + qfn_ext=la +fi +for qfn_lib in $2; do + if eval test x'"${$1_need_'$qfn_lib'}"' = xyes; then + qfn_tmp="${$1_libs} lib$qfn_lib.$qfn_ext" + eval '$1_libs="$qfn_tmp"' + fi +done +AC_SUBST($1_libs) +]) diff --git a/configure.ac b/configure.ac index 211e87c06..da0601bab 100644 --- a/configure.ac +++ b/configure.ac @@ -1569,8 +1569,9 @@ if test "x$HAVE_FBDEV" = xyes; then CL_TARGETS="$CL_TARGETS FBDEV" VID_TARGETS="$VID_TARGETS libQFfbdev.la" BUILD_SW=yes - vid_need_common=yes - vid_need_sw=yes + QF_NEED(vid, [common sw]) + QF_NEED(qw, [client common net]) + QF_NEED(nq, [client common net]) fi CAN_BUILD_SW=yes fi @@ -1583,9 +1584,9 @@ if test "x$HAVE_X" = xyes; then CL_TARGETS="$CL_TARGETS GLX" VID_TARGETS="$VID_TARGETS libQFglx.la" BUILD_GL=yes - vid_need_common=yes - vid_need_gl=yes - vid_need_x11=yes + QF_NEED(vid, [common gl x11]) + QF_NEED(qw, [client common net]) + QF_NEED(nq, [client common net]) fi if test "x$ENABLE_X11" = xyes; then QW_TARGETS="$QW_TARGETS qw-client-x11\$(EXEEXT)" @@ -1593,9 +1594,9 @@ if test "x$HAVE_X" = xyes; then CL_TARGETS="$CL_TARGETS X11" VID_TARGETS="$VID_TARGETS libQFx11.la" BUILD_SW=yes - vid_need_common=yes - vid_need_sw=yes - vid_need_x11=yes + QF_NEED(vid, [common sw x11]) + QF_NEED(qw, [client common net]) + QF_NEED(nq, [client common net]) fi fi if test "x$HAVE_MGL" = xyes; then @@ -1605,8 +1606,9 @@ if test "x$HAVE_MGL" = xyes; then CL_TARGETS="$CL_TARGETS MGL" VID_TARGETS="$VID_TARGETS libQFwgl.la" BUILD_SW=yes - vid_need_common=yes - vid_need_sw=yes + QF_NEED(vid, [common sw]) + QF_NEED(qw, [client common net]) + QF_NEED(nq, [client common net]) fi CAN_BUILD_SW=yes fi @@ -1617,9 +1619,9 @@ if test "x$HAVE_SDL" = xyes; then CL_TARGETS="$CL_TARGETS SDL" VID_TARGETS="$VID_TARGETS libQFsdl.la" BUILD_SW=yes - vid_need_common=yes - vid_need_sdl=yes - vid_need_sw=yes + QF_NEED(vid, [common sdl sw]) + QF_NEED(qw, [client common net sdl]) + QF_NEED(nq, [client common net sdl]) fi CAN_BUILD_SW=yes if test "x$ENABLE_SDL32" = xyes; then @@ -1628,9 +1630,9 @@ if test "x$HAVE_SDL" = xyes; then CL_TARGETS="$CL_TARGETS SDL32" VID_TARGETS="$VID_TARGETS libQFsdl32.la" BUILD_SW32=yes - vid_need_common=yes - vid_need_sdl=yes - vid_need_sw32=yes + QF_NEED(vid, [common sdl sw32]) + QF_NEED(qw, [client common net sdl]) + QF_NEED(nq, [client common net sdl]) fi CAN_BUILD_SW32=yes if test "x$ENABLE_SGL" = xyes; then @@ -1639,10 +1641,10 @@ if test "x$HAVE_SDL" = xyes; then CL_TARGETS="$CL_TARGETS SDL-GL" VID_TARGETS="$VID_TARGETS libQFsgl.la" BUILD_GL=yes - vid_need_common=yes - vid_need_gl=yes - vid_need_sdl=yes CAN_BUILD_GL=yes + QF_NEED(vid, [common sdl gl]) + QF_NEED(qw, [client common net sdl]) + QF_NEED(nq, [client common net sdl]) fi fi if test "x$HAVE_SVGA" = xyes; then @@ -1652,10 +1654,9 @@ if test "x$HAVE_SVGA" = xyes; then CL_TARGETS="$CL_TARGETS SVGAlib" VID_TARGETS="$VID_TARGETS libQFsvga.la" BUILD_SW=yes - vid_need_asm=yes - vid_need_common=yes - vid_need_sw=yes - vid_need_svga=yes + QF_NEED(vid, [asm common svga sw]) + QF_NEED(qw, [client common net]) + QF_NEED(nq, [client common net]) fi CAN_BUILD_SW=yes if test "x$ENABLE_3DFX" = xyes; then @@ -1664,10 +1665,9 @@ if test "x$HAVE_SVGA" = xyes; then CL_TARGETS="$CL_TARGETS 3dfx" VID_TARGETS="$VID_TARGETS libQFtdfx.la" BUILD_GL=yes - vid_need_asm=yes - vid_need_common=yes - vid_need_gl=yes - vid_need_svga=yes + QF_NEED(vid, [asm common gl svga]) + QF_NEED(qw, [client common net]) + QF_NEED(nq, [client common net]) fi CAN_BUILD_GL=yes fi @@ -1678,48 +1678,18 @@ if test "x$mingw" = xyes; then CL_TARGETS="$CL_TARGETS WGL" VID_TARGETS="$VID_TARGETS libQFwgl.la" BUILD_GL=yes - vid_need_common=yes - vid_need_gl=yes + QF_NEED(vid, [common gl]) + QF_NEED(qw, [client common net]) + QF_NEED(nq, [client common net]) fi CAN_BUILD_GL=yes fi -if test "$vid_need_x11" = yes; then - VID_TARGETS="$VID_TARGETS libx11.la" -fi - -if test "$vid_need_svga" = yes; then - VID_TARGETS="$VID_TARGETS libsvga.la" -fi - -if test "$vid_need_sw32" = yes; then - VID_TARGETS="$VID_TARGETS libsw32.la" -fi - -if test "$vid_need_sw" = yes; then - VID_TARGETS="$VID_TARGETS libsw.la" -fi - -if test "$vid_need_sdl" = yes; then - VID_TARGETS="$VID_TARGETS libsdl.la" -fi - -if test "$vid_need_gl" = yes; then - VID_TARGETS="$VID_TARGETS libgl.la" -fi - -if test "$vid_need_common" = yes; then - VID_TARGETS="$VID_TARGETS libcommon.la" -fi - -if test "$vid_need_asm" = yes; then - VID_TARGETS="$VID_TARGETS libasm.la" -fi - unset SV_TARGETS if test "x$ENABLE_NQ_SERVER" = xyes; then NQ_TARGETS="nq-server\$(EXEEXT) $NQ_TARGETS" SV_TARGETS="$SV_TARGETS nq" + QF_NEED(nq, [common net server]) fi if test "x$ENABLE_QW_MASTER" = xyes; then QW_TARGETS="qw-master\$(EXEEXT) $QW_TARGETS" @@ -1728,6 +1698,7 @@ fi if test "x$ENABLE_QW_SERVER" = xyes; then QW_TARGETS="qw-server\$(EXEEXT) $QW_TARGETS" SV_TARGETS="$SV_TARGETS qw" + QF_NEED(qw, [common net server]) fi if test "x$BUILD_SW" = xyes; then @@ -1745,6 +1716,10 @@ if test "x$BUILD_GL" = xyes; then VID_MODEL_TARGETS="$VID_MODEL_TARGETS libQFmodels_gl.la" fi +QF_PROCESS_NEED(vid, [asm common gl sdl sw sw32 svga x11]) +QF_PROCESS_NEED(qw, [client common net sdl server], a) +QF_PROCESS_NEED(nq, [client common net sdl server], a) + AC_SUBST(CAN_BUILD_GL) AC_SUBST(CAN_BUILD_SW) AC_SUBST(CAN_BUILD_SW32) diff --git a/nq/source/Makefile.am b/nq/source/Makefile.am index bf3c3ef83..d1bff3996 100644 --- a/nq/source/Makefile.am +++ b/nq/source/Makefile.am @@ -44,13 +44,13 @@ else asm= endif -asm_src= worlda.S +noinst_LIBRARIES= @nq_libs@ $(asm) +EXTRA_LIBRARIES=libasm.a libclient.a libcommon.a libnet.a libsdl.a libserver.a -libasm_a_SOURCES= $(asm_src) - -noinst_LIBRARIES= libcommon.a libclient.a libserver.a libqfnet.a $(asm) - -libcommon_a_SOURCES= game.c locs.c world.c com.c +libasm_a_SOURCES= worlda.S +libcommon_a_SOURCES=game.c locs.c world.c com.c +libsdl_a_SOURCES= sys_sdl.c +libsdl_a_CFLAGS= $(SDL_CFLAGS) common_ldflags= -export-dynamic @@ -60,9 +60,9 @@ net_sources= net_win.c net_wins.c else net_sources= net_bsd.c net_udp.c endif -libqfnet_a_SOURCES= net_dgrm.c net_loop.c net_main.c net_vcr.c $(net_sources) +libnet_a_SOURCES= net_dgrm.c net_loop.c net_main.c net_vcr.c $(net_sources) -EXTRA_libqfnet_a_SOURCES= \ +EXTRA_libnet_a_SOURCES= \ net_dos.c net_bw.c net_bsd.c net_ipx.c net_mp.c net_win.c net_wins.c \ net_wipx.c net_udp.c @@ -82,7 +82,7 @@ server_LIBFILES= \ common_LIBFILES= \ libasm.a \ - libqfnet.a \ + libnet.a \ $(top_builddir)/libs/console/libQFconsole.la \ $(top_builddir)/libs/gamecode/builtins/libQFgamecode_builtins.la \ $(top_builddir)/libs/gamecode/engine/libQFgamecode.la \ @@ -118,7 +118,7 @@ nq_fbdev_libs= \ $(soft_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFfbdev.la \ $(client_LIBS) -nq_fbdev_SOURCES= $(combined_sources) sys_unix.c +nq_fbdev_SOURCES= sys_unix.c nq_fbdev_LDADD= $(nq_fbdev_libs) $(NET_LIBS) nq_fbdev_LDFLAGS= $(common_ldflags) nq_fbdev_DEPENDENCIES= $(nq_fbdev_libs) @@ -130,19 +130,20 @@ nq_mgl_libs= \ $(soft_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFmgl.la \ $(client_LIBS) -nq_mgl_SOURCES= $(combined_sources) sys_win.c +nq_mgl_SOURCES= sys_win.c nq_mgl_LDADD= $(nq_mgl_libs) $(MGL_LIBS) $(NET_LIBS) nq_mgl_LDFLAGS= $(common_ldflags) nq_mgl_DEPENDENCIES= $(nq_mgl_libs) # ... SDL, version 1.2 and higher nq_sdl_libs= \ + libsdl.a \ $(client_libs) \ $(cl_plugin_LIBS) \ $(soft_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFsdl.la \ $(client_LIBS) -nq_sdl_SOURCES= $(combined_sources) sys_sdl.c +nq_sdl_SOURCES= nq_sdl_LDADD= $(nq_sdl_libs) $(SDL_LIBS) $(NET_LIBS) nq_sdl_LDFLAGS= $(common_ldflags) nq_sdl_CFLAGS= $(SDL_CFLAGS) @@ -150,13 +151,14 @@ nq_sdl_DEPENDENCIES= $(nq_sdl_libs) # ... 32-bit software, SDL nq_sdl32_libs= \ + libsdl.a \ $(client_libs) \ $(cl_plugin_LIBS) \ $(top_builddir)/libs/video/renderer/libQFrenderer_sw32.la \ $(top_builddir)/libs/models/libQFmodels_sw.la \ $(top_builddir)/libs/video/targets/libQFsdl32.la \ $(client_LIBS) -nq_sdl32_SOURCES= $(combined_sources) sys_sdl.c +nq_sdl32_SOURCES= nq_sdl32_LDADD= $(nq_sdl32_libs) $(SDL_LIBS) $(NET_LIBS) nq_sdl32_LDFLAGS= $(common_ldflags) nq_sdl32_CFLAGS= $(SDL_CFLAGS) @@ -169,7 +171,7 @@ nq_svga_libs= \ $(soft_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFsvga.la \ $(client_LIBS) -nq_svga_SOURCES= $(combined_sources) sys_unix.c +nq_svga_SOURCES= sys_unix.c nq_svga_LDADD= $(nq_svga_libs) $(SVGA_LIBS) $(NET_LIBS) nq_svga_LDFLAGS= $(common_ldflags) nq_svga_DEPENDENCIES= $(nq_svga_libs) @@ -181,7 +183,7 @@ nq_x11_libs= \ $(soft_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFx11.la \ $(client_LIBS) -nq_x11_SOURCES= $(combined_sources) sys_unix.c +nq_x11_SOURCES= sys_unix.c nq_x11_LDADD= $(nq_x11_libs) \ $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 \ $(X_EXTRA_LIBS) $(X_SHM_LIB) $(NET_LIBS) @@ -201,7 +203,7 @@ nq_3dfx_libs= \ $(opengl_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFtdfx.la \ $(client_LIBS) -nq_3dfx_SOURCES= $(combined_sources) sys_unix.c +nq_3dfx_SOURCES= sys_unix.c nq_3dfx_LDADD= $(nq_3dfx_libs) $(SVGA_LIBS) $(NET_LIBS) nq_3dfx_LDFLAGS= $(common_ldflags) nq_3dfx_DEPENDENCIES= $(nq_3dfx_libs) @@ -213,7 +215,7 @@ nq_glx_libs= \ $(opengl_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFglx.la \ $(client_LIBS) -nq_glx_SOURCES= $(combined_sources) sys_unix.c +nq_glx_SOURCES= sys_unix.c nq_glx_LDADD= $(nq_glx_libs) \ $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 \ -lXext $(X_EXTRA_LIBS) $(DL_LIBS) $(NET_LIBS) @@ -222,12 +224,13 @@ nq_glx_DEPENDENCIES= $(nq_glx_libs) # ... Simple Directmedia Layer, version 1.2 and higher, in GL mode nq_sgl_libs= \ + libsdl.a \ $(client_libs) \ $(cl_plugin_LIBS) \ $(opengl_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFsgl.la \ $(client_LIBS) -nq_sgl_SOURCES= $(combined_sources) sys_sdl.c +nq_sgl_SOURCES= nq_sgl_LDADD= $(nq_sgl_libs) $(SDL_LIBS) $(DL_LIBS) $(NET_LIBS) nq_sgl_LDFLAGS= $(common_ldflags) nq_sgl_CFLAGS= $(SDL_CFLAGS) @@ -240,7 +243,7 @@ nq_wgl_libs= \ $(opengl_QFLIBS) \ $(top_builddir)/libs/video/targets/libQFwgl.la \ $(client_LIBS) -nq_wgl_SOURCES= $(combined_sources) conproc.c sys_win.c +nq_wgl_SOURCES= conproc.c sys_win.c nq_wgl_LDADD= $(nq_wgl_libs) -lgdi32 -lcomctl32 -lwinmm $(NET_LIBS) nq_wgl_LDFLAGS= $(common_ldflags) nq_wgl_DEPENDENCIES= $(nq_wgl_libs) @@ -258,7 +261,6 @@ nq_server_DEPENDENCIES= $(server_libs) $(server_LIB_DEPS) # Stuff that doesn't get linked into an executable NEEDS to be mentioned here, # or it won't be distributed with 'make dist' -EXTRA_DIST= $(asm_src) # Kill the temp files, hopefully. CLEANFILES = *.i *.s $(YACCLEX_CLEANFILES) diff --git a/qw/source/Makefile.am b/qw/source/Makefile.am index 9c346d846..cf52ca943 100644 --- a/qw/source/Makefile.am +++ b/qw/source/Makefile.am @@ -45,13 +45,14 @@ else asm= endif -asm_src= worlda.S +noinst_LIBRARIES= @qw_libs@ $(asm) +EXTRA_LIBRARIES=libasm.a libclient.a libcommon.a libnet.a libsdl.a libserver.a -libasm_a_SOURCES= $(asm_src) - -noinst_LIBRARIES= libqfnet.a libcommon.a libserver.a libclient.a $(asm) +libasm_a_SOURCES= worlda.S libcommon_a_SOURCES= com.c game.c msg_ucmd.c pmove.c pmovetst.c net_packetlog.c +libsdl_a_SOURCES=cl_sys_sdl.c +libsdl_a_CFLAGS=$(SDL_CFLAGS) common_ldflags= -export-dynamic @@ -63,8 +64,8 @@ ipvX_src= $(ipv6_src) else ipvX_src= $(ipv4_src) endif -libqfnet_a_SOURCES= net_chan.c $(ipvX_src) -EXTRA_libqfnet_a_SOURCES= $(ipv4_src) $(ipv6_src) +libnet_a_SOURCES= net_chan.c $(ipvX_src) +EXTRA_libnet_a_SOURCES= $(ipv4_src) $(ipv6_src) # Server builds # @@ -90,9 +91,9 @@ qf_server_LIBS= \ $(top_builddir)/libs/util/libQFutil.la qw_server_SOURCES= sv_model.c -qw_server_LDADD= libserver.a libcommon.a libqfnet.a libasm.a $(qf_server_LIBS) $(NET_LIBS) $(DL_LIBS) $(CURSES_LIBS) +qw_server_LDADD= libserver.a libcommon.a libnet.a libasm.a $(qf_server_LIBS) $(NET_LIBS) $(DL_LIBS) $(CURSES_LIBS) qw_server_LDFLAGS= $(common_ldflags) -qw_server_DEPENDENCIES= libcommon.a libserver.a libqfnet.a libasm.a $(qf_server_LIBS) +qw_server_DEPENDENCIES= libcommon.a libserver.a libnet.a libasm.a $(qf_server_LIBS) qw_master_SOURCES= master.c qw_master_LDADD= $(top_builddir)/libs/util/libQFutil.la $(NET_LIBS) @@ -111,7 +112,7 @@ qf_client_LIBS= \ $(top_builddir)/libs/audio/libQFsound.la \ $(top_builddir)/libs/util/libQFutil.la -client_LIBS= libqfnet.a libasm.a $(qf_client_LIBS) +client_LIBS= libnet.a libasm.a $(qf_client_LIBS) client_libs= libclient.a libcommon.a libclient_a_SOURCES= \ @@ -157,11 +158,11 @@ qw_client_sdl_libs= \ $(soft_LIBS) \ $(top_builddir)/libs/video/targets/libQFsdl.la \ $(client_LIBS) -qw_client_sdl_SOURCES= cl_sys_sdl.c -qw_client_sdl_LDADD= $(qw_client_sdl_libs) $(SDL_LIBS) $(NET_LIBS) +qw_client_sdl_SOURCES= +qw_client_sdl_LDADD= libsdl.a $(qw_client_sdl_libs) $(SDL_LIBS) $(NET_LIBS) qw_client_sdl_LDFLAGS= $(common_ldflags) qw_client_sdl_CFLAGS=$(SDL_CFLAGS) -qw_client_sdl_DEPENDENCIES= $(qw_client_sdl_libs) +qw_client_sdl_DEPENDENCIES= libsdl.a $(qw_client_sdl_libs) # ... 32-bit software, SDL qw_client_sdl32_libs= \ @@ -171,11 +172,11 @@ qw_client_sdl32_libs= \ $(top_builddir)/libs/models/libQFmodels_sw.la \ $(top_builddir)/libs/video/targets/libQFsdl32.la \ $(client_LIBS) -qw_client_sdl32_SOURCES=cl_sys_sdl.c -qw_client_sdl32_LDADD= $(qw_client_sdl32_libs) $(SDL_LIBS) $(NET_LIBS) +qw_client_sdl32_SOURCES= +qw_client_sdl32_LDADD= libsdl.a $(qw_client_sdl32_libs) $(SDL_LIBS) $(NET_LIBS) qw_client_sdl32_LDFLAGS=$(common_ldflags) qw_client_sdl32_CFLAGS=$(SDL_CFLAGS) -qw_client_sdl32_DEPENDENCIES= $(qw_client_sdl32_libs) +qw_client_sdl32_DEPENDENCIES= libsdl.a $(qw_client_sdl32_libs) # ... Linux SVGAlib qw_client_svga_libs= \ @@ -185,9 +186,9 @@ qw_client_svga_libs= \ $(top_builddir)/libs/video/targets/libQFsvga.la \ $(client_LIBS) qw_client_svga_SOURCES= cl_sys_unix.c -qw_client_svga_LDADD= $(qw_client_svga_libs) $(SVGA_LIBS) $(NET_LIBS) +qw_client_svga_LDADD= libsdl.a $(qw_client_svga_libs) $(SVGA_LIBS) $(NET_LIBS) qw_client_svga_LDFLAGS= $(common_ldflags) -qw_client_svga_DEPENDENCIES= $(qw_client_svga_libs) +qw_client_svga_DEPENDENCIES= libsdl.a $(qw_client_svga_libs) # ... X11 qw_client_x11_libs= \ @@ -242,7 +243,7 @@ qw_client_sgl_libs= \ $(opengl_LIBS) \ $(top_builddir)/libs/video/targets/libQFsgl.la \ $(client_LIBS) -qw_client_sgl_SOURCES= cl_sys_sdl.c +qw_client_sgl_SOURCES= qw_client_sgl_LDADD= $(qw_client_sgl_libs) $(SDL_LIBS) $(DL_LIBS) $(NET_LIBS) qw_client_sgl_LDFLAGS= $(common_ldflags) qw_client_sgl_CFLAGS=$(SDL_CFLAGS) @@ -262,7 +263,6 @@ qw_client_wgl_DEPENDENCIES= $(qw_client_wgl_libs) # Stuff that doesn't get linked into an executable NEEDS to be mentioned here, # or it won't be distributed with 'make dist' -EXTRA_DIST= $(asm_src) # Kill the temp files, hopefully. CLEANFILES = *.i *.s $(YACCLEX_CLEANFILES)