1.1 --- a/trace_plugin/Makefile Sat May 29 23:04:02 2004 +0000
1.2 +++ b/trace_plugin/Makefile Sat May 29 23:08:20 2004 +0000
1.3 @@ -1,380 +1,6 @@
1.4 -# vi: set ts=4 sw=4 :
1.5 -# vim: set tw=75 :
1.6 -
1.7 -# MetaMod makefile
1.8 -# Copyright (c) 2001-2003 Will Day <[email protected]>
1.9 -#
1.10 -# based on the Valve SDK 2.1 Makefile as well as the Makefile
1.11 -# in adminmod by Alfred Reynolds.
1.12 -#
1.13 -# From SDK 2.1 dlls/Makefile:
1.14 -#! Half-Life StandardSDK 2.0 mp_i386.so Makefile for i386 Linux
1.15 -#! April 2000 by Leon Hartwig ([email protected])
1.16 -
1.17 -
1.18 -# NOTE: This is a generic Makefile for metamod and the bundled plugins, and
1.19 -# is symlinked into each subdir. Per-module config statements are in
1.20 -# Config.mak in each subdir.
1.21 -
1.22 -ifdef COMSPEC
1.23 - OS=windows
1.24 -else
1.25 - OS=linux
1.26 -endif
1.27 -
1.28 -#############################################################################
1.29 -# CONFIGURATION
1.30 -#############################################################################
1.31 -
1.32 -# set paths for your environment
1.33 -ifeq "$(OS)" "linux"
1.34 - PATH_WIN=/usr/local/cross-tools/i586-mingw32msvc/bin
1.35 - SDKTOP=$(HOME)/src/hl/hlsdk-2.3
1.36 - INST_DIR=$(HOME)/half-life/cstrike/dlls
1.37 - TEST_DIR=$(HOME)/test/tfc/dlls
1.38 - TST_DIR=$(HOME)/tmp
1.39 -else ## windows
1.40 - PATH_WIN=/gcc-2.95.2-msvcrt/bin
1.41 - SDKTOP=/hlsdk2.3
1.42 - INST_DIR=/hlserver/tfc/dlls
1.43 - TEST_DIR=/hlserver/tfc/dlls
1.44 -endif
1.45 -
1.46 -DLLS_DIR=../dlls
1.47 -SDKSRC=$(SDKTOP)/multiplayer
1.48 -METADIR=../metamod
1.49 -
1.50 -
1.51 -#############################################################################
1.52 -# OS DEPENDENCIES
1.53 -#############################################################################
1.54 -
1.55 -ifeq "$(OS)" "linux"
1.56 - INSTALL=install -m 644
1.57 - LD_WINDLL= PATH=$(PATH_WIN) $(PATH_WIN)/dllwrap
1.58 - TARGET=linux
1.59 - LIBFILE=$(LIBFILE_LINUX)
1.60 - TARGET_FILE=$(TARGET_LINUX)
1.61 -else ## windows
1.62 - INSTALL=cp
1.63 - LD_WINDLL= $(PATH_WIN)/dllwrap
1.64 - TARGET=win32
1.65 - LIBFILE=$(LIBFILE_WIN)
1.66 - TARGET_FILE=$(TARGET_WIN)
1.67 -endif
1.68 -
1.69 -CC_WIN=$(PATH_WIN)/gcc
1.70 -RES_WIN=$(PATH_WIN)/windres
1.71 -OBJDIR_LINUX_OPT=opt.linux
1.72 -OBJDIR_WIN_OPT=opt.win32
1.73 -OBJDIR_LINUX_DBG=debug.linux
1.74 -OBJDIR_WIN_DBG=debug.win32
1.75 -
1.76 -
1.77 -#############################################################################
1.78 -# COMPILE OPTIONS
1.79 -#############################################################################
1.80 -
1.81 -# original safe optimization, from valve Makefile
1.82 -#CCOPT = -O2 -ffast-math -funroll-loops \
1.83 -# -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
1.84 -# -malign-jumps=2 -malign-functions=2
1.85 -
1.86 -# safe optimization, adapted from adminmod Makefile
1.87 -#CCOPT = -m486 -O6 -ffast-math -funroll-loops \
1.88 -# -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 \
1.89 -# -malign-functions=2 -Wall
1.90 -
1.91 -# full optimization, adapted from adminmod Makefile
1.92 -# "WONT WORK WITH omit-frame-pointer"?
1.93 -# - disable (unneeded) C++ exceptions and rtti code to save some space ?
1.94 -CCOPT = -march=i586 $(CCO) -ffast-math -funroll-loops \
1.95 - -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
1.96 - -malign-jumps=2 -malign-functions=2 -fno-exceptions -fno-rtti -s
1.97 -
1.98 -# optimization level; overridden for certain problematic files
1.99 -CCO = -O6
1.100 -
1.101 -# debugging; halt on warnings
1.102 -CCDEBUG+= -ggdb3
1.103 -
1.104 -
1.105 -#############################################################################
1.106 -# COMPILE SETUP
1.107 -#############################################################################
1.108 -
1.109 -CC=gcc-2.95
1.110 -
1.111 -SRCDIR=.
1.112 -INCLUDEDIRS=-I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC)
1.113 -FILES_ALL = *.cpp *.h [A-Z]* *.rc
1.114 -
1.115 -CFLAGS=-Wall -Wno-unknown-pragmas
1.116 -#CFLAGS += -DTEST
1.117 -
1.118 -ifeq "$(USER)" "willday"
1.119 - # extra warnings
1.120 - CFLAGS+=-W -Wundef \
1.121 - -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align \
1.122 - -Wconversion -Wsign-compare \
1.123 - -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
1.124 - -Wmissing-noreturn -Wnested-externs -Winline \
1.125 - -Wlong-long
1.126 - # extra C++ warnings
1.127 - CFLAGS+=-Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \
1.128 - -Woverloaded-virtual -Wsign-promo -Wsynth -Weffc++
1.129 - # undesired warnings
1.130 - #CFLAGS+=-pedantic -Waggregate-return -Wredundant-decls -Wtraditional
1.131 - # to help debugging; requires edited SDK
1.132 - CCDEBUG+=-Werror
1.133 - # link against older libc for compatibility
1.134 - EXTRA_LINK = -L../priv/libc -lc
1.135 -endif
1.136 -
1.137 -ifeq "$(OPT)" "opt"
1.138 - ODEF = -DOPT_TYPE=\"optimized\"
1.139 - CFLAGS := $(CCOPT) $(CFLAGS) $(ODEF)
1.140 - OBJDIR_LINUX = $(OBJDIR_LINUX_OPT)
1.141 - OBJDIR_WIN = $(OBJDIR_WIN_OPT)
1.142 -else # debug
1.143 - ODEF = -DOPT_TYPE=\"debugging\"
1.144 - CFLAGS := $(CCDEBUG) $(CFLAGS) $(ODEF)
1.145 - OBJDIR_LINUX = $(OBJDIR_LINUX_DBG)
1.146 - OBJDIR_WIN = $(OBJDIR_WIN_DBG)
1.147 - DLLS_DIR := $(DLLS_DIR)/debug
1.148 -endif
1.149 -
1.150 -include Config.mak
1.151 -# any local CFLAGS from Config.mak
1.152 -CFLAGS += $(EXTRA_CFLAGS)
1.153 -
1.154 -# ignore complaints from SDK files like cbase.h
1.155 -$(OBJDIR_LINUX)/sdk_util.o $(OBJDIR_WIN)/sdk_util.o: CFLAGS += -Wno-unused
1.156 -
1.157 -# ignore complaints from STL headers
1.158 -STLOBJ = $(STLFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
1.159 -STLOBJ += $(STLFILES:%.cpp=$(OBJDIR_WIN)/%.o)
1.160 -#$(OBJDIR_LINUX)/mreg.o $(OBJDIR_WIN)/mreg.o: CFLAGS += -Wno-effc++
1.161 -$(STLOBJ): FILTER= 2>&1 | ../tools/stlfilter
1.162 -$(STLOBJ): CFLAGS += -Wno-error
1.163 -
1.164 -# these files seem to create "Internal compiler error" errors under mingw
1.165 -# when using -O6
1.166 -#$(OBJDIR_WIN)/engine_api.o: CCO = -O5
1.167 -#$(OBJDIR_WIN)/dllapi_api.o: CCO = -O5
1.168 -
1.169 -#############################################################################
1.170 -# BUILDING LINUX SO
1.171 -#############################################################################
1.172 -
1.173 -# linux .so compile commands
1.174 -DO_CC_LINUX=$(CC) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $< $(FILTER)
1.175 -LINK_LINUX=$(CC) $(CFLAGS) -shared -ldl -lm $(EXTRA_LINK) $(OBJ_LINUX) -o $@
1.176 -
1.177 -# sort by date
1.178 -ifeq "$(OS)" "linux"
1.179 -SRCFILES := $(shell ls -t $(SRCFILES))
1.180 -endif
1.181 -# linux object files
1.182 -OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
1.183 -
1.184 -# compiling linux object files
1.185 -$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.cpp
1.186 - $(DO_CC_LINUX)
1.187 -
1.188 -# linux .so target file
1.189 -LIBFILE_LINUX = $(MODNAME)_i386.so
1.190 -TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX)
1.191 -
1.192 +# Since this file is under CVS control and we cannot store
1.193 +# symbolic links in CVS (and neither under Windows) we
1.194 +# include the Makefile from the metamod directory instead
1.195 +# of linking to it.
1.196
1.197 -#############################################################################
1.198 -# BUILDING WINDOWS DLL
1.199 -#############################################################################
1.200 -
1.201 -# windows .dll compile commands
1.202 -DO_CC_WIN=$(CC_WIN) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
1.203 -DO_RES_WIN=$(RES_WIN) '$(ODEF)' --include-dir . --include-dir ../metamod -i $< -O coff -o $@
1.204 -#LINK_WIN=$(LD_WINDLL) -k -mwindows --add-stdcall-alias --def metamod.def -o $@ $(OBJ_WIN)
1.205 -#LINK_WIN=$(LD_WINDLL) -A -k -mwindows --export-all-symbols -o $@ $(OBJ_WIN)
1.206 -LINK_WIN=$(LD_WINDLL) -mwindows --add-stdcall-alias $(OBJ_WIN) $(RES_OBJ_WIN) -o $@
1.207 -
1.208 -# windows object files
1.209 -OBJ_WIN := $(SRCFILES:%.cpp=$(OBJDIR_WIN)/%.o)
1.210 -RES_OBJ_WIN := $(RESFILE:%.rc=$(OBJDIR_WIN)/%.o)
1.211 -
1.212 -# compiling windows object files
1.213 -$(OBJDIR_WIN)/%.o: $(SRCDIR)/%.cpp
1.214 - $(DO_CC_WIN)
1.215 -
1.216 -# compiling windows resource file
1.217 -$(OBJDIR_WIN)/%.o: $(SRCDIR)/%.rc $(INFOFILES)
1.218 - $(DO_RES_WIN)
1.219 -
1.220 -# windows .dll target file
1.221 -LIBFILE_WIN = $(MODNAME).dll
1.222 -TARGET_WIN = $(OBJDIR_WIN)/$(LIBFILE_WIN)
1.223 -
1.224 -
1.225 -#############################################################################
1.226 -# OVERRIDES
1.227 -#############################################################################
1.228 -
1.229 -ifeq "$(PLATFORM)" "linux-only"
1.230 - LIBFILE_WIN =
1.231 - TARGET_WIN =
1.232 -endif
1.233 -ifeq "$(PLATFORM)" "win32-only"
1.234 - LIBFILE_LINUX =
1.235 - TARGET_LINUX =
1.236 - TARGET=win32
1.237 - LIBFILE=$(LIBFILE_WIN)
1.238 - TARGET_FILE=$(TARGET_WIN)
1.239 -endif
1.240 -
1.241 -
1.242 -#############################################################################
1.243 -# BUILD RULES
1.244 -#############################################################################
1.245 -
1.246 -default: $(TARGET_FILE)
1.247 -
1.248 -ifeq "$(USER)" "willday"
1.249 -include ../priv/metamod.mak
1.250 -endif
1.251 -
1.252 -all: do_dll_linux do_dll_win32
1.253 -
1.254 -opt:
1.255 - $(MAKE) default OPT=opt
1.256 -
1.257 -linux: do_dll_linux
1.258 -win32: do_dll_win32
1.259 -
1.260 -linux_opt:
1.261 - $(MAKE) linux OPT=opt
1.262 -win32_opt:
1.263 - $(MAKE) win32 OPT=opt
1.264 -
1.265 -$(TARGET_LINUX): msgs/debug msgs/log msgs/error $(OBJDIR_LINUX) $(OBJ_LINUX)
1.266 - $(LINK_LINUX)
1.267 -
1.268 -# for plugins, recompile meta_api.cpp if info_name.h changed
1.269 -$(OBJDIR_LINUX)/meta_api.o $(OBJDIR_WIN)/meta_api.o: info_name.h
1.270 -
1.271 -ifeq "$(USER)" "willday"
1.272 -$(TARGET_LINUX): .tags .htags
1.273 -endif
1.274 -
1.275 -$(TARGET_WIN): $(OBJDIR_WIN) $(OBJ_WIN) $(RES_OBJ_WIN)
1.276 - $(LINK_WIN)
1.277 -
1.278 -$(OBJDIR_LINUX) $(OBJDIR_WIN) msgs:
1.279 - mkdir $@
1.280 -
1.281 -# make sure to recompile vdate.c for each link
1.282 -$(OBJDIR_LINUX)/vdate.o $(OBJDIR_WIN)/vdate.o : $(SRCFILES) *.h
1.283 -
1.284 -domsgs: msgs/debug msgs/log msgs/error
1.285 -
1.286 -msgs/debug: $(SRCFILES) *.h msgs
1.287 - egrep "DEBUG\([0-9]" $(SRCFILES) *.h | sed "s/:[ ]*/ /" | sort -k2,2 > $@
1.288 -
1.289 -msgs/log: $(SRCFILES) *.h msgs
1.290 - egrep "META_LOG\(" $(SRCFILES) *.h | sed "s/:[ ]*/ /" | sort > $@
1.291 -
1.292 -msgs/error: $(SRCFILES) *.h msgs
1.293 - egrep "META_ERROR\(" $(SRCFILES) *.h | sed "s/:[ ]*/ /" | sort > $@
1.294 -
1.295 -tags: .tags .htags
1.296 -ctags: .tags
1.297 -htags: .htags
1.298 -
1.299 -.tags: $(SRCFILES) *.h
1.300 - -ctags -a $?
1.301 -
1.302 -.htags: *.h
1.303 - -htags $?
1.304 -
1.305 -retags:
1.306 - -rm -f .tags .htags
1.307 - ctags -f .tags `find $(SDKSRC) -name '*.h'`
1.308 - ctags -f .tags -a `find $(METADIR) -name old -prune -o -name '*.h' -print`
1.309 - ctags -f .tags -a $(SRCFILES)
1.310 - htags -R $(SDKSRC)
1.311 - htags `find $(METADIR) -name old -prune -o -name '*.h' -print`
1.312 - htags *.h
1.313 -
1.314 -clean: clean_$(TARGET)
1.315 -
1.316 -clean_linux:
1.317 - test -n "$(OBJDIR_LINUX)"
1.318 - -rm -f $(OBJDIR_LINUX)/*
1.319 -
1.320 -clean_win32:
1.321 - test -n "$(OBJDIR_WIN)"
1.322 - -rm -f $(OBJDIR_WIN)/*
1.323 -
1.324 -cleanall_linux:
1.325 - $(MAKE) clean_linux
1.326 - $(MAKE) clean_linux OPT=opt
1.327 -
1.328 -cleanall_win32:
1.329 - $(MAKE) clean_win32
1.330 - $(MAKE) clean_win32 OPT=opt
1.331 -
1.332 -cleanall: cleanall_linux cleanall_win32
1.333 -
1.334 -dll_linux dll_win32:
1.335 - $(MAKE) do_$@
1.336 - $(MAKE) do_$@ OPT=opt
1.337 -
1.338 -do_dll_linux: $(DLLS_DIR) $(DLLS_DIR)/$(LIBFILE_LINUX)
1.339 -do_dll_win32: $(DLLS_DIR) $(DLLS_DIR)/$(LIBFILE_WIN)
1.340 -
1.341 -$(DLLS_DIR):
1.342 - mkdir $(DLLS_DIR)
1.343 -
1.344 -$(DLLS_DIR)/$(LIBFILE_LINUX): $(TARGET_LINUX)
1.345 - $(INSTALL) $+ $@
1.346 -
1.347 -$(DLLS_DIR)/$(LIBFILE_WIN): $(TARGET_WIN)
1.348 - $(INSTALL) $+ $@
1.349 -
1.350 -dlls: dll_linux dll_win32
1.351 -rmdlls:
1.352 - -rm -f ../dlls/*.* ../dlls/debug/*.*
1.353 -
1.354 -spotless: cleanall
1.355 - -rmdir $(OBJDIR_LINUX) $(OBJDIR_WIN)
1.356 - -rm -f .snap $(GENERATED)
1.357 -
1.358 -distclean: spotless
1.359 -
1.360 -install: $(INST_DIR)/$(LIBFILE)
1.361 -test: $(TEST_DIR)/$(LIBFILE)
1.362 -test_opt:
1.363 - $(MAKE) test OPT=opt
1.364 -
1.365 -$(INST_DIR)/$(LIBFILE) $(TEST_DIR)/$(LIBFILE): $(TARGET_FILE)
1.366 - $(INSTALL) $< $@
1.367 -
1.368 -tst: $(TST_DIR)/$(LIBFILE_WIN)
1.369 -
1.370 -$(TST_DIR)/$(LIBFILE_WIN): $(TARGET_WIN)
1.371 - cp $< $@
1.372 -
1.373 -snap: .snap
1.374 -
1.375 -.snap: $(FILES_ALL)
1.376 - mkdir -p snapshots
1.377 - tar zcvf snapshots/`date '+%m%d-%H%M'`.tgz $(FILES_ALL)
1.378 - touch .snap
1.379 -
1.380 -depend: Rules.depend
1.381 -
1.382 -ifeq "$(OS)" "linux"
1.383 -Rules.depend: $(SRCFILES)
1.384 - $(CC) -MM $(INCLUDEDIRS) $(SRCFILES) | sed "s;\(^[^ ]*\):\(.*\);$(OBJDIR_LINUX)/\1 $(OBJDIR_WIN)/\1: \2;" > $@
1.385 -endif
1.386 -
1.387 -include Rules.depend
1.388 +include ../metamod/Makefile