metamod/Makefile
author Scott Ehlert <ds@alliedmods.net>
Thu Sep 26 17:00:32 2013 -0500 (2013-09-26)
changeset 284 ca90ccdb8d49
parent 278 18fc23cf45d8
child 285 4c5d8420c970
permissions -rw-r--r--
Fixed makefile error when issuing 'make clean' or 'make distclean'.
darope@0
     1
# vi: set ts=4 sw=4 :
darope@0
     2
# vim: set tw=75 :
darope@0
     3
darope@0
     4
# MetaMod makefile
darope@0
     5
# Copyright (c) 2001-2003 Will Day <[email protected]>
darope@0
     6
#
darope@0
     7
# based on the Valve SDK 2.1 Makefile as well as the Makefile
darope@0
     8
# in adminmod by Alfred Reynolds.
darope@0
     9
#
darope@0
    10
# From SDK 2.1 dlls/Makefile:
darope@0
    11
#! Half-Life StandardSDK 2.0 mp_i386.so Makefile for i386 Linux
darope@0
    12
#! April 2000 by Leon Hartwig ([email protected])
darope@0
    13
darope@0
    14
darope@0
    15
# NOTE: This is a generic Makefile for metamod and the bundled plugins, and
darope@0
    16
# is symlinked into each subdir.  Per-module config statements are in
darope@0
    17
# Config.mak in each subdir.
darope@0
    18
darope@0
    19
ifdef COMSPEC
darope@0
    20
	OS=windows
darope@0
    21
else
ds@267
    22
	OS:=$(shell uname -s)
darope@0
    23
endif
darope@0
    24
darope@0
    25
#############################################################################
darope@0
    26
# CONFIGURATION
darope@0
    27
#############################################################################
darope@0
    28
darope@0
    29
# set paths for your environment
ds@267
    30
ifeq "$(OS)" "Linux"
darope@0
    31
	PATH_WIN=/usr/local/cross-tools/i586-mingw32msvc/bin
darope@236
    32
	SDKTOP=../../hlsdk
darope@236
    33
	INST_DIR=/usr/local/hlds_l/addons/metamod/dlls
darope@0
    34
else	## windows
darope@0
    35
	PATH_WIN=/gcc-2.95.2-msvcrt/bin
darope@236
    36
	SDKTOP=../../hlsdk
darope@0
    37
	INST_DIR=/hlserver/tfc/dlls
darope@0
    38
endif
darope@0
    39
darope@240
    40
DLLS_DIR=../dlls
darope@0
    41
METADIR=../metamod
darope@0
    42
darope@236
    43
# set compiler to use
ds@267
    44
ifneq "$(OS)" "Darwin"
ds@267
    45
	CC=gcc		## Windows/Linux	
ds@267
    46
else
ds@267
    47
	CC=clang	## Darwin/Mac OS X
ds@267
    48
endif
darope@236
    49
darope@236
    50
darope@244
    51
# set timezone string
ds@267
    52
ifneq (,$(filter Linux Darwin,$(OS)))
darope@244
    53
	COMPILE_TZ=$(shell date +%z)
darope@244
    54
else
darope@244
    55
	COMPILE_TZ=
darope@244
    56
endif
darope@236
    57
darope@244
    58
darope@236
    59
## Developer overrrides
darope@236
    60
ifeq "$(USER)" "willday"
darope@244
    61
	CC=gcc-2.95
ds@267
    62
    ifeq "$(OS)" "Linux"
darope@236
    63
       SDKTOP=$(HOME)/src/hl/hlsdk-2.3
darope@236
    64
       INST_DIR=$(HOME)/half-life/cstrike/dlls
darope@236
    65
       TEST_DIR=$(HOME)/test/tfc/dlls
darope@236
    66
       TST_DIR=$(HOME)/tmp
darope@236
    67
    else
darope@236
    68
       SDKTOP=/hlsdk
darope@236
    69
       TEST_DIR=/hlserver/tfc/dlls
darope@236
    70
    endif
darope@236
    71
endif
darope@236
    72
ifeq "$(USER)" "flori"
darope@236
    73
    PATH_WIN=/usr/local/cross-tools/i386-mingw32msvc/bin
darope@236
    74
    TEST_DIR=/data/hlds_l/Admin/dlls
darope@236
    75
endif
darope@236
    76
ds@277
    77
SDKSRC=$(SDKTOP)
darope@0
    78
darope@0
    79
#############################################################################
darope@0
    80
# OS DEPENDENCIES
darope@0
    81
#############################################################################
darope@0
    82
darope@241
    83
ARCH=i586
darope@244
    84
ARCHD=
ds@267
    85
ifeq "$(OS)" "Linux"
darope@0
    86
	INSTALL=install -m 644
darope@0
    87
	LD_WINDLL= PATH=$(PATH_WIN) $(PATH_WIN)/dllwrap
darope@0
    88
	TARGET=linux
darope@0
    89
	LIBFILE=$(LIBFILE_LINUX)
darope@0
    90
	TARGET_FILE=$(TARGET_LINUX)
darope@244
    91
	ARCHD = $(shell uname -m)
darope@244
    92
	ifeq "$(ARCHD)" "x86_64"
ds@266
    93
		ifeq "$(ARCH)" "i386"
ds@266
    94
			ARCHD=
ds@266
    95
			MODARCH=i386
ds@266
    96
		else
ds@266
    97
			ARCH=x86_64
ds@266
    98
			ARCHD=.amd64
ds@266
    99
			MODARCH=amd64
ds@266
   100
		endif
darope@244
   101
	else
darope@244
   102
		ARCHD=
ds@266
   103
		MODARCH=i386
darope@244
   104
	endif
ds@267
   105
else
ds@267
   106
	ifeq "$(OS)" "Darwin"	## Mac OS X
ds@267
   107
		INSTALL=cp
ds@267
   108
		TARGET=darwin
ds@267
   109
		LIBFILE=$(LIBFILE_DARWIN)
ds@267
   110
		TARGET_FILE=$(TARGET_DARWIN)
ds@267
   111
		MODARCH=i386
ds@267
   112
	else			## windows
ds@267
   113
		INSTALL=cp
ds@267
   114
		LD_WINDLL= $(PATH_WIN)/dllwrap
ds@267
   115
		TARGET=win32
ds@267
   116
		LIBFILE=$(LIBFILE_WIN)
ds@267
   117
		TARGET_FILE=$(TARGET_WIN)
ds@267
   118
	endif
darope@0
   119
endif
darope@0
   120
darope@0
   121
CC_WIN=$(PATH_WIN)/gcc
darope@0
   122
RES_WIN=$(PATH_WIN)/windres
darope@244
   123
OBJDIR_LINUX_OPT=opt.linux$(ARCHD)
darope@0
   124
OBJDIR_WIN_OPT=opt.win32
ds@267
   125
OBJDIR_DARWIN_OPT=opt.darwin
darope@244
   126
OBJDIR_LINUX_DBG=debug.linux$(ARCHD)
darope@0
   127
OBJDIR_WIN_DBG=debug.win32
ds@267
   128
OBJDIR_DARWIN_DBG=debug.darwin
darope@0
   129
darope@0
   130
darope@0
   131
#############################################################################
darope@0
   132
# COMPILE OPTIONS
darope@0
   133
#############################################################################
darope@0
   134
ds@267
   135
GCCMAJ = $(shell $(CC) -dumpversion | sed -e 's/\.[0-9][0-9]*\.[0-9]//')
darope@241
   136
darope@0
   137
# original safe optimization, from valve Makefile
darope@0
   138
#CCOPT = -O2 -ffast-math -funroll-loops \
darope@0
   139
#	-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
darope@0
   140
#	-malign-jumps=2 -malign-functions=2
darope@0
   141
darope@0
   142
# safe optimization, adapted from adminmod Makefile
darope@0
   143
#CCOPT = -m486 -O6 -ffast-math -funroll-loops \
darope@0
   144
# -fexpensive-optimizations -malign-loops=2  -malign-jumps=2 \
darope@0
   145
# -malign-functions=2 -Wall
darope@0
   146
darope@0
   147
# full optimization, adapted from adminmod Makefile
darope@0
   148
# "WONT WORK WITH omit-frame-pointer"?
darope@0
   149
# - disable (unneeded) C++ exceptions and rtti code to save some space ?
ds@267
   150
ifneq "$(OS)" "Darwin"
ds@267
   151
	ifeq "$(ARCH)" "x86_64"
ds@267
   152
		# K8 targets only available from gcc 3.4 on.
ds@267
   153
		CCOPT =
ds@267
   154
	else
ds@267
   155
		CCOPT = -march=$(ARCH)
ds@267
   156
	endif
darope@244
   157
endif
darope@241
   158
darope@241
   159
CCOPT += $(CCO) -ffast-math -funroll-loops \
darope@241
   160
	-fomit-frame-pointer -fexpensive-optimizations \
ds@271
   161
	-fno-exceptions -fno-rtti
darope@241
   162
dvander@264
   163
CCOPT += -falign-loops=2 -falign-jumps=2 -falign-functions=2 
darope@0
   164
ds@270
   165
ifeq "$(GCCMAJ)" "4"
ds@270
   166
	CCOPT += -fvisibility=hidden -fvisibility-inlines-hidden
ds@270
   167
endif
ds@270
   168
ds@271
   169
# ld on OS X doesn't actually strip symbols with this flag
ds@271
   170
ifneq "$(OS)" "Darwin"
ds@271
   171
	CCOPT += -s
ds@271
   172
	STRIP_CMD =
ds@271
   173
else
ds@271
   174
	STRIP_CMD = strip -ux $(TARGET_DARWIN)
ds@271
   175
endif
ds@271
   176
darope@0
   177
# optimization level; overridden for certain problematic files
ds@267
   178
CCO = -O3
darope@0
   179
darope@0
   180
# debugging; halt on warnings
darope@0
   181
CCDEBUG+= -ggdb3
darope@0
   182
darope@0
   183
darope@0
   184
#############################################################################
darope@0
   185
# COMPILE SETUP
darope@0
   186
#############################################################################
darope@0
   187
darope@0
   188
darope@0
   189
SRCDIR=.
ds@277
   190
INCLUDEDIRS=-I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common \
ds@277
   191
	-I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC)/public -I$(SDKSRC)
darope@0
   192
FILES_ALL = *.cpp *.h [A-Z]* *.rc
darope@0
   193
darope@0
   194
CFLAGS=-Wall -Wno-unknown-pragmas 
darope@0
   195
#CFLAGS += -DTEST
darope@236
   196
darope@236
   197
ifeq "$(USER)" "flori"
darope@236
   198
	# extra warnings
darope@236
   199
	CFLAGS+=-W -Wundef \
darope@241
   200
		-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align \
darope@236
   201
		-Wconversion -Wsign-compare \
darope@241
   202
		-Wstrict-prototypes -Wmissing-prototypes \
darope@241
   203
		-Wmissing-noreturn -Winline \
darope@236
   204
		-Wlong-long 
darope@241
   205
	ifeq "$(GCCMAJ)" "2"
darope@241
   206
		CFLAGS += -Wbad-function-cast -Wmissing-declarations -Wnested-externs
darope@241
   207
	else
darope@241
   208
		CFLAGS += -Wno-deprecated
darope@241
   209
	endif
darope@236
   210
	# extra C++ warnings
darope@236
   211
	CFLAGS+=-Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \
darope@236
   212
		-Woverloaded-virtual -Wsign-promo -Wsynth -Weffc++
darope@236
   213
	# undesired warnings
darope@236
   214
	#CFLAGS+=-pedantic -Waggregate-return -Wredundant-decls -Wtraditional 
darope@236
   215
	# to help debugging; requires edited SDK
darope@236
   216
	CCDEBUG+=-Werror
darope@236
   217
	# link against older libc for compatibility
darope@243
   218
	#EXTRA_LINK = -L../../priv/libc -lc
darope@236
   219
endif
darope@236
   220
darope@0
   221
ifeq "$(USER)" "willday"
darope@0
   222
	# extra warnings
darope@0
   223
	CFLAGS+=-W -Wundef \
darope@0
   224
		-Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align \
darope@0
   225
		-Wconversion -Wsign-compare \
darope@0
   226
		-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
darope@0
   227
		-Wmissing-noreturn -Wnested-externs -Winline \
darope@0
   228
		-Wlong-long 
darope@0
   229
	# extra C++ warnings
darope@0
   230
	CFLAGS+=-Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \
darope@0
   231
		-Woverloaded-virtual -Wsign-promo -Wsynth -Weffc++
darope@0
   232
	# undesired warnings
darope@0
   233
	#CFLAGS+=-pedantic -Waggregate-return -Wredundant-decls -Wtraditional 
darope@0
   234
	# to help debugging; requires edited SDK
darope@0
   235
	CCDEBUG+=-Werror
darope@0
   236
	# link against older libc for compatibility
darope@0
   237
	EXTRA_LINK = -L../priv/libc -lc
darope@0
   238
endif
darope@0
   239
darope@0
   240
ifeq "$(OPT)" "opt"
darope@0
   241
	ODEF = -DOPT_TYPE=\"optimized\"
darope@0
   242
	CFLAGS := $(CCOPT) $(CFLAGS) $(ODEF)
darope@240
   243
	OBJDIR_LINUX = $(OBJDIR_LINUX_OPT)
darope@240
   244
	OBJDIR_WIN = $(OBJDIR_WIN_OPT)
ds@267
   245
	OBJDIR_DARWIN = $(OBJDIR_DARWIN_OPT)
darope@0
   246
else	# debug
darope@0
   247
	ODEF = -DOPT_TYPE=\"debugging\"
darope@0
   248
	CFLAGS := $(CCDEBUG) $(CFLAGS) $(ODEF)
darope@240
   249
	OBJDIR_LINUX = $(OBJDIR_LINUX_DBG)
darope@240
   250
	OBJDIR_WIN = $(OBJDIR_WIN_DBG)
ds@267
   251
	OBJDIR_DARWIN = $(OBJDIR_DARWIN_DBG)
darope@0
   252
	DLLS_DIR := $(DLLS_DIR)/debug
ds@271
   253
	STRIP_CMD =
darope@0
   254
endif
darope@0
   255
darope@0
   256
include Config.mak
darope@0
   257
# any local CFLAGS from Config.mak
darope@0
   258
CFLAGS += $(EXTRA_CFLAGS)
darope@0
   259
ds@266
   260
ifeq "$(MODARCH)" "i386"
ds@266
   261
	CFLAGS += -m32
ds@266
   262
endif
ds@266
   263
darope@236
   264
# provide timezone info
ds@267
   265
$(OBJDIR_LINUX)/vdate.o $(OBJDIR_DARWIN)/vdate.o $(OBJDIR_WIN)/vdate.o: CFLAGS += -DCOMPILE_TZ=\"$(COMPILE_TZ)\"
darope@236
   266
darope@0
   267
# ignore complaints from SDK files like cbase.h
ds@267
   268
$(OBJDIR_LINUX)/sdk_util.o $(OBJDIR_DARWIN)/sdk_util.o $(OBJDIR_WIN)/sdk_util.o: CFLAGS += -Wno-unused
darope@0
   269
darope@0
   270
# ignore complaints from STL headers 
ds@267
   271
STLOBJ = $(STLFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
ds@267
   272
STLOBJ += $(STLFILES:%.cpp=$(OBJDIR_WIN)/%.o)
ds@267
   273
STLOBJ += $(STLFILES:%.cpp=%(OBJDIR_DARWIN/%.o)
ds@267
   274
#$(OBJDIR_LINUX)/mreg.o $(OBJDIR_DARWIN)/mreg.o $(OBJDIR_WIN)/mreg.o: CFLAGS += -Wno-effc++
darope@0
   275
$(STLOBJ): FILTER= 2>&1 | ../tools/stlfilter
darope@0
   276
$(STLOBJ): CFLAGS += -Wno-error
darope@0
   277
darope@0
   278
# these files seem to create "Internal compiler error" errors under mingw
darope@0
   279
# when using -O6
ds@267
   280
#$(OBJDIR_WIN)/engine_api.o: CCO = -O2
ds@267
   281
#$(OBJDIR_WIN)/dllapi_api.o: CCO = -O2
darope@0
   282
darope@0
   283
#############################################################################
darope@0
   284
# BUILDING LINUX SO
darope@0
   285
#############################################################################
darope@0
   286
darope@0
   287
# linux .so compile commands
darope@0
   288
DO_CC_LINUX=$(CC) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $< $(FILTER)
darope@0
   289
LINK_LINUX=$(CC) $(CFLAGS) -shared -ldl -lm $(EXTRA_LINK) $(OBJ_LINUX) -o $@
darope@0
   290
darope@0
   291
# sort by date
ds@267
   292
ifeq "$(OS)" "Linux"
darope@0
   293
SRCFILES := $(shell ls -t $(SRCFILES))
darope@0
   294
endif
ds@267
   295
darope@0
   296
# linux object files
darope@0
   297
OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
darope@0
   298
darope@0
   299
# compiling linux object files
darope@0
   300
$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.cpp
darope@0
   301
	$(DO_CC_LINUX)
darope@0
   302
darope@0
   303
# linux .so target file
dvander@264
   304
LIBFILE_LINUX = $(MODNAME).so
darope@0
   305
TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX)
darope@0
   306
ds@267
   307
#############################################################################
ds@267
   308
# BUILDING DARWIN DYLIB
ds@267
   309
#############################################################################
ds@267
   310
ds@267
   311
# darwin .dylib compile commands
ds@267
   312
DO_CC_DARWIN=$(CC) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $< $(FILTER)
ds@278
   313
LINK_DARWIN=$(CC) $(CFLAGS) -dynamiclib -ldl -lm -lstdc++ -mmacosx-version-min=10.5 $(EXTRA_LINK) $(OBJ_DARWIN) -o $@
ds@267
   314
ds@267
   315
# sort by date
ds@267
   316
ifeq "$(OS)" "Darwin"
ds@267
   317
SRCFILES := $(shell ls -t $(SRCFILES))
ds@267
   318
endif
ds@267
   319
ds@267
   320
# darwin object files
ds@267
   321
OBJ_DARWIN := $(SRCFILES:%.cpp=$(OBJDIR_DARWIN)/%.o)
ds@267
   322
ds@267
   323
# compiling darwin object files
ds@267
   324
$(OBJDIR_DARWIN)/%.o: $(SRCDIR)/%.cpp
ds@267
   325
	$(DO_CC_DARWIN)
ds@267
   326
ds@267
   327
# darwin .dylib target file
ds@267
   328
LIBFILE_DARWIN = $(MODNAME).dylib
ds@267
   329
TARGET_DARWIN = $(OBJDIR_DARWIN)/$(LIBFILE_DARWIN)
darope@0
   330
darope@0
   331
#############################################################################
darope@0
   332
# BUILDING WINDOWS DLL
darope@0
   333
#############################################################################
darope@0
   334
darope@0
   335
# windows .dll compile commands
darope@0
   336
DO_CC_WIN=$(CC_WIN) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
darope@0
   337
DO_RES_WIN=$(RES_WIN) '$(ODEF)' --include-dir . --include-dir ../metamod -i $< -O coff -o $@
darope@0
   338
#LINK_WIN=$(LD_WINDLL) -k -mwindows --add-stdcall-alias --def metamod.def -o $@ $(OBJ_WIN)
darope@0
   339
#LINK_WIN=$(LD_WINDLL) -A -k -mwindows --export-all-symbols -o $@ $(OBJ_WIN)
darope@0
   340
LINK_WIN=$(LD_WINDLL) -mwindows --add-stdcall-alias $(OBJ_WIN) $(RES_OBJ_WIN) -o $@
darope@0
   341
darope@0
   342
# windows object files
darope@0
   343
OBJ_WIN := $(SRCFILES:%.cpp=$(OBJDIR_WIN)/%.o)
darope@0
   344
RES_OBJ_WIN := $(RESFILE:%.rc=$(OBJDIR_WIN)/%.o)
darope@0
   345
darope@0
   346
# compiling windows object files
darope@0
   347
$(OBJDIR_WIN)/%.o: $(SRCDIR)/%.cpp
darope@0
   348
	$(DO_CC_WIN)
darope@0
   349
darope@0
   350
# compiling windows resource file
darope@0
   351
$(OBJDIR_WIN)/%.o: $(SRCDIR)/%.rc $(INFOFILES)
darope@0
   352
	$(DO_RES_WIN)
darope@0
   353
darope@0
   354
# windows .dll target file
darope@0
   355
LIBFILE_WIN = $(MODNAME).dll
darope@0
   356
TARGET_WIN = $(OBJDIR_WIN)/$(LIBFILE_WIN)
darope@0
   357
darope@0
   358
darope@0
   359
#############################################################################
darope@0
   360
# OVERRIDES
darope@0
   361
#############################################################################
darope@0
   362
darope@0
   363
ifeq "$(PLATFORM)" "linux-only"
darope@0
   364
	LIBFILE_WIN =
darope@0
   365
	TARGET_WIN =
ds@267
   366
	LIBFILE_DARWIN =
ds@267
   367
	TARGET_DARWIN =
darope@0
   368
endif
darope@0
   369
ifeq "$(PLATFORM)" "win32-only"
darope@0
   370
	LIBFILE_LINUX =
darope@0
   371
	TARGET_LINUX =
ds@267
   372
	LIBFILE_DARWIN =
ds@267
   373
	TARGET_DARWIN =
darope@0
   374
	TARGET=win32
darope@0
   375
	LIBFILE=$(LIBFILE_WIN)
darope@0
   376
	TARGET_FILE=$(TARGET_WIN)
darope@0
   377
endif
darope@0
   378
darope@0
   379
darope@0
   380
#############################################################################
darope@0
   381
# BUILD RULES
darope@0
   382
#############################################################################
darope@0
   383
darope@0
   384
default: $(TARGET_FILE)
darope@0
   385
darope@0
   386
ifeq "$(USER)" "willday"
darope@0
   387
include ../priv/metamod.mak
darope@0
   388
endif
darope@241
   389
ifeq "$(USER)" "flori"
darope@243
   390
include ../../priv/metamod.mak
darope@241
   391
endif
darope@0
   392
ds@267
   393
all: do_dll_linux do_dll_darwin do_dll_win32
darope@0
   394
darope@0
   395
opt:
darope@0
   396
	$(MAKE) default OPT=opt
darope@0
   397
darope@0
   398
linux: do_dll_linux
darope@0
   399
win32: do_dll_win32
ds@267
   400
darwin: do_dll_darwin
darope@0
   401
darope@0
   402
linux_opt: 
darope@0
   403
	$(MAKE) linux OPT=opt
darope@0
   404
win32_opt: 
darope@0
   405
	$(MAKE) win32 OPT=opt
ds@267
   406
darwin_opt:
ds@267
   407
	$(MAKE) darwin OPT=opt
darope@0
   408
ds@266
   409
linux32:
ds@266
   410
	$(MAKE) linux ARCH=i386
ds@266
   411
linux32_opt:
ds@266
   412
	$(MAKE) linux ARCH=i386 OPT=opt
ds@266
   413
darope@0
   414
$(TARGET_LINUX): msgs/debug msgs/log msgs/error $(OBJDIR_LINUX) $(OBJ_LINUX)
darope@0
   415
	$(LINK_LINUX)
darope@0
   416
ds@267
   417
$(TARGET_DARWIN): msgs/debug msgs/log msgs/error $(OBJDIR_DARWIN) $(OBJ_DARWIN)
ds@267
   418
	$(LINK_DARWIN)
ds@271
   419
	$(STRIP_CMD)
ds@267
   420
darope@0
   421
# for plugins, recompile meta_api.cpp if info_name.h changed
ds@267
   422
$(OBJDIR_LINUX)/meta_api.o $(OBJDIR_DARWIN)/meta_api.o $(OBJDIR_WIN)/meta_api.o: info_name.h
darope@0
   423
darope@0
   424
ifeq "$(USER)" "willday"
darope@0
   425
$(TARGET_LINUX): .tags .htags
darope@0
   426
endif
darope@0
   427
darope@0
   428
$(TARGET_WIN): $(OBJDIR_WIN) $(OBJ_WIN) $(RES_OBJ_WIN)
darope@0
   429
	$(LINK_WIN)
darope@0
   430
ds@267
   431
$(OBJDIR_LINUX) $(OBJDIR_DARWIN) $(OBJDIR_WIN) msgs:
darope@236
   432
	mkdir -p $@
darope@0
   433
darope@0
   434
# make sure to recompile vdate.c for each link
ds@267
   435
$(OBJDIR_LINUX)/vdate.o $(OBJDIR_DARWIN)/vdate.o $(OBJDIR_WIN)/vdate.o : $(SRCFILES) *.h 
darope@236
   436
darope@236
   437
ifdef LINKED_SRCFILES
darope@236
   438
# copy linked files
darope@236
   439
$(LINKED_SRCFILES): $(LINK_DEST_DIR)/$@
darope@236
   440
	cp -f $(LINK_DEST_DIR)/$@ $@
darope@236
   441
endif
darope@0
   442
darope@0
   443
domsgs: msgs/debug msgs/log msgs/error
darope@0
   444
darope@0
   445
msgs/debug: $(SRCFILES) *.h msgs
darope@0
   446
	egrep "DEBUG\([0-9]" $(SRCFILES) *.h | sed "s/:[ 	]*/	/" | sort -k2,2 > $@
darope@0
   447
darope@0
   448
msgs/log: $(SRCFILES) *.h msgs
darope@0
   449
	egrep "META_LOG\(" $(SRCFILES) *.h | sed "s/:[ 	]*/	/" | sort > $@
darope@0
   450
darope@0
   451
msgs/error: $(SRCFILES) *.h msgs
darope@0
   452
	egrep "META_ERROR\(" $(SRCFILES) *.h | sed "s/:[ 	]*/	/" | sort > $@
darope@0
   453
darope@0
   454
tags:	.tags .htags
darope@0
   455
ctags:	.tags
darope@0
   456
htags:	.htags
darope@0
   457
darope@0
   458
.tags: $(SRCFILES) *.h
darope@0
   459
	-ctags -a $?
darope@0
   460
darope@0
   461
.htags: *.h
darope@0
   462
	-htags $?
darope@0
   463
darope@0
   464
retags:
darope@0
   465
	-rm -f .tags .htags
darope@0
   466
	ctags -f .tags `find $(SDKSRC) -name '*.h'`
darope@0
   467
	ctags -f .tags -a `find $(METADIR) -name old -prune -o -name '*.h' -print`
darope@0
   468
	ctags -f .tags -a $(SRCFILES)
darope@0
   469
	htags -R $(SDKSRC)
darope@0
   470
	htags `find $(METADIR) -name old -prune -o -name '*.h' -print`
darope@0
   471
	htags *.h
darope@0
   472
darope@0
   473
clean: clean_$(TARGET)
darope@0
   474
darope@0
   475
clean_linux:
darope@0
   476
	test -n "$(OBJDIR_LINUX)"
darope@236
   477
#	-rm -f $(OBJDIR_LINUX)/*
darope@236
   478
	-rm -rf $(OBJDIR_LINUX)
darope@0
   479
ds@267
   480
clean_darwin:
ds@267
   481
	test -n "$(OBJDIR_DARWIN)"
ds@267
   482
#	-rm -f $(OBJDIR_DARWIN)/*
ds@267
   483
	-rm -rf $(OBJDIR_DARWIN)
ds@267
   484
darope@0
   485
clean_win32:
darope@0
   486
	test -n "$(OBJDIR_WIN)"
darope@236
   487
#	-rm -f $(OBJDIR_WIN)/*
darope@236
   488
	-rm -rf $(OBJDIR_WIN)
darope@0
   489
ds@266
   490
clean_linux32:
ds@266
   491
	$(MAKE) clean_linux ARCH=i386
ds@266
   492
darope@240
   493
cleanall_linux:
darope@0
   494
	$(MAKE) clean_linux
ds@266
   495
	$(MAKE) clean_linux32
darope@0
   496
	$(MAKE) clean_linux OPT=opt
ds@266
   497
	$(MAKE) clean_linux32 OPT=opt
darope@0
   498
ds@267
   499
cleanall_darwin:
ds@267
   500
	$(MAKE) clean_darwin
ds@267
   501
	$(MAKE) clean_darwin OPT=opt
ds@267
   502
darope@240
   503
cleanall_win32:
darope@0
   504
	$(MAKE) clean_win32
darope@0
   505
	$(MAKE) clean_win32 OPT=opt
darope@0
   506
ds@267
   507
cleanall: cleanall_linux cleanall_darwin cleanall_win32
darope@0
   508
ds@267
   509
dll_linux dll_darwin dll_win32: 
darope@0
   510
	$(MAKE) do_$@
darope@0
   511
	$(MAKE) do_$@ OPT=opt
darope@0
   512
darope@0
   513
do_dll_linux: $(DLLS_DIR) $(DLLS_DIR)/$(LIBFILE_LINUX)
darope@0
   514
do_dll_win32: $(DLLS_DIR) $(DLLS_DIR)/$(LIBFILE_WIN)
ds@267
   515
do_dll_darwin: $(DLL_DIR) $(DLLS_DIR)/$(LIBFILE_DARWIN)
darope@0
   516
darope@0
   517
$(DLLS_DIR):
darope@236
   518
	mkdir -p $(DLLS_DIR)
darope@0
   519
darope@0
   520
$(DLLS_DIR)/$(LIBFILE_LINUX): $(TARGET_LINUX)
darope@0
   521
	$(INSTALL) $+ $@
darope@0
   522
darope@0
   523
$(DLLS_DIR)/$(LIBFILE_WIN): $(TARGET_WIN)
darope@0
   524
	$(INSTALL) $+ $@
darope@0
   525
ds@267
   526
$(DLLS_DIR)/$(LIBFILE_DARWIN): $(TARGET_DARWIN)
ds@267
   527
	$(INSTALL) $+ $@
ds@267
   528
ds@267
   529
dlls: dll_linux dlls_darwin dll_win32
darope@0
   530
rmdlls:
darope@240
   531
	-rm -f ../dlls/*.* ../dlls/debug/*.*
darope@0
   532
darope@0
   533
spotless: cleanall
ds@284
   534
	-rm -rf $(OBJDIR_LINUX) $(OBJDIR_DARWIN) $(OBJDIR_WIN)
darope@0
   535
	-rm -f .snap $(GENERATED)
darope@0
   536
darope@0
   537
distclean:	spotless
darope@0
   538
darope@0
   539
install: $(INST_DIR)/$(LIBFILE)
darope@0
   540
test: $(TEST_DIR)/$(LIBFILE)
darope@0
   541
test_opt:
darope@0
   542
	$(MAKE) test OPT=opt
darope@0
   543
darope@0
   544
$(INST_DIR)/$(LIBFILE) $(TEST_DIR)/$(LIBFILE): $(TARGET_FILE)
darope@0
   545
	$(INSTALL) $< $@
darope@0
   546
darope@0
   547
tst: $(TST_DIR)/$(LIBFILE_WIN)
darope@0
   548
darope@0
   549
$(TST_DIR)/$(LIBFILE_WIN): $(TARGET_WIN)
darope@0
   550
	cp $< $@
darope@0
   551
darope@0
   552
snap:	.snap
darope@0
   553
darope@0
   554
.snap: $(FILES_ALL)
darope@0
   555
	mkdir -p snapshots
darope@0
   556
	tar zcvf snapshots/`date '+%m%d-%H%M'`.tgz $(FILES_ALL)
darope@0
   557
	touch .snap
darope@0
   558
	
darope@0
   559
depend: Rules.depend
darope@0
   560
ds@267
   561
ifneq (,$(filter Linux Darwin,$(OS)))
darope@0
   562
Rules.depend: $(SRCFILES)
ds@267
   563
	$(CC) -MM $(INCLUDEDIRS) $(SRCFILES) | sed "s;\(^[^ 	]*\):\(.*\);$(OBJDIR_LINUX)/\1 $(OBJDIR_DARWIN)/\1 $(OBJDIR_WIN)/\1: \2;" > $@
darope@0
   564
endif
darope@0
   565
darope@0
   566
include Rules.depend