29
ifneq ($(wildcard $(WVSTREAMS_SRC)/config.mk),)
30
include $(WVSTREAMS_SRC)/config.mk
33
include $(WVSTREAMS_SRC)/config.defaults.mk
34
-include $(WVSTREAMS_SRC)/config.mk
35
-include $(WVSTREAMS_SRC)/config.overrides.mk
36
-include $(WVSTREAMS_SRC)/local.mk
33
38
ifeq (${EXEEXT},.exe)
34
include $(WVSTREAMS_SRC)/wvrules-win32.mk
40
XPATH += $(WVSTREAMS)/win32 $(WVSTREAMS)/win32/cominclude
41
AR=i586-mingw32msvc-ar
42
LIBS += -lssl -lcrypto -lz -lole32 -lrpcrt4 -lwsock32 -lgdi32 -limagehlp \
43
-lxplc-cxx -lxplc -lstdc++
49
include $(WVSTREAMS_SRC)/wvrules-$(COMPILER_STANDARD).mk
37
51
ifeq (${WVTESTRUN},)
38
WVTESTRUN=$(WVSTREAMS_BIN)/wvtesthelper
41
ifneq ("$(with_xplc)", "no")
42
ifneq ("$(with_xplc)", "")
43
LDFLAGS:=-L$(with_xplc) $(LDFLAGS)
48
LIBWVBASE=$(WVSTREAMS_LIB)/libwvbase.so
49
LIBWVUTILS=$(WVSTREAMS_LIB)/libwvutils.so $(LIBWVBASE)
50
LIBWVSTREAMS=$(WVSTREAMS_LIB)/libwvstreams.so $(LIBWVUTILS)
51
LIBUNICONF=$(WVSTREAMS_LIB)/libuniconf.so $(LIBWVSTREAMS)
52
LIBWVQT=$(WVSTREAMS_LIB)/libwvqt.so $(LIBWVSTREAMS)
53
LIBWVTEST=$(WVSTREAMS_LIB)/libwvtest.a $(LIBWVUTILS)
56
# Initial C compilation flags
58
CPPFLAGS += $(CPPOPTS)
59
C_AND_CXX_FLAGS += -D_BSD_SOURCE -D_GNU_SOURCE $(OSDEFINE) \
60
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
61
CFLAGS += $(COPTS) $(C_AND_CXX_FLAGS)
62
CXXFLAGS += $(CXXOPTS) $(C_AND_CXX_FLAGS)
63
LDFLAGS += $(LDOPTS) -L$(WVSTREAMS_LIB)
65
# Default compiler we use for linking
68
# FIXME: what does this do??
69
XX_LIBS := $(XX_LIBS) $(shell $(CC) -lsupc++ -lgcc_eh 2>&1 | grep -q "undefined reference" && echo " -lsupc++ -lgcc_eh")
71
ifeq ("$(enable_debug)", "yes")
77
ifeq ("$(enable_fatal_warnings)", "yes")
79
# FIXME: not for C, because our only C file, crypto/wvsslhack.c, has
80
# a few warnings on purpose.
84
ifneq ("$(enable_optimization)", "no")
86
#CXXFLAGS+=-felide-constructors
90
ifneq ("$(enable_warnings)", "no")
91
CXXFLAGS+=-Wall -Woverloaded-virtual
95
ifeq ("$(enable_rtti)", "no")
99
ifneq ("$(enable_exceptions)", "yes")
100
CXXFLAGS+=-fno-exceptions
103
ifeq ("$(enable_efence)", "yes")
112
ifeq ("$(enable_verbose)", "yes")
117
VERBOSE:=1 $(warning DONT_LIE is deprecated, use VERBOSE instead)
120
STRIP=strip --remove-section=.note --remove-section=.comment
52
WVTESTRUN=$(WVSTREAMS_BIN)/wvtestrunner.pl
123
55
# macros that expand to the object files in the given directories
124
56
objects=$(sort $(foreach type,c cc,$(call objects_$(type),$1)))
125
objects_c=$(patsubst %.c,%.o,$(wildcard $(addsuffix /*.c,$1)))
126
objects_cc=$(patsubst %.cc,%.o,$(wildcard $(addsuffix /*.cc,$1)))
128
# macro that expands to the subdir.mk files to include
129
xsubdirs=$(sort $(wildcard $1/*/subdir.mk)) /dev/null
131
# we need a default rule, since the 'includes' below causes trouble
57
objects_c=$(filter-out $(WV_EXCLUDES), \
58
$(patsubst %.c,%.o,$(wildcard $(addsuffix /*.c,$1))))
59
objects_cc=$(filter-out $(WV_EXCLUDES), \
60
$(patsubst %.cc,%.o,$(wildcard $(addsuffix /*.cc,$1))))
61
tests_cc=$(filter-out $(WV_EXCLUDES), \
62
$(patsubst %.cc,%,$(wildcard $(addsuffix /*.cc,$1))))
135
64
# default "test" rule does nothing...
136
.PHONY: test runtests clean-valgrind
138
runtests: clean-valgrind
141
@rm -f valgrind.log.pid*
144
70
$(MAKE) -C $(dir $@) test
146
$(WVSTREAMS_SRC)/rules.local.mk:
149
-include $(WVSTREAMS_SRC)/rules.local.mk
152
# Figure out which OS we're running (for now, only picks out Linux or BSD)
154
OS:=$(shell uname -a | awk '{print $$1}' | sed -e 's/^.*BSD/BSD/g' )
157
# (Just BSD and LINUX clash with other symbols, so use ISLINUX and ISBSD)
158
# This sucks. Use autoconf for most things!
170
XX_LIBS += -lccmalloc -ldl
175
C_AND_CXX_FLAGS += -ggdb -DDEBUG=1
178
C_AND_CXX_FLAGS += -g -DDEBUG=0
179
#CFLAGS += -DNDEBUG # I don't like disabling assertions...
180
#CFLAGS += -fomit-frame-pointer # really evil
181
#CXXFLAGS += -fno-implement-inlines # causes trouble with egcs 1.0
194
72
INCFLAGS=$(addprefix -I,$(WVSTREAMS_INC) $(XPATH))
195
CPPFLAGS+=$(INCFLAGS)
197
CXXFLAGS+=$(CPPFLAGS)
73
CPPFLAGS+=$(INCFLAGS) \
74
-D_BSD_SOURCE -D_GNU_SOURCE $(OSDEFINE) \
75
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
199
78
ifeq ($(VERBOSE),1)
228
107
# usage: $(wvln,source,dest)
229
108
wvln=$(SYMLINK_MSG)$(LN) -f $1 $2
231
# usage: $(wvcc_base,outfile,infile,stem,compiler cflags,mode)
232
# eg: $(wvcc,foo.o,foo.cc,foo,$(CC) $(CFLAGS) -fPIC,-c)
233
DEPFILE = $(if $(filter %.o,$1),$(dir $1).$(notdir $(1:.o=.d)),/dev/null)
236
$(COMPILE_MSG)$4 $5 $2 -o $1
237
@# The Perl script here generates the proper dependencies, including
238
@# null dependencies so Make doesn't complain
239
$(DEPEND_MSG)$4 -M -E $< \
241
'$$a = '"'"'$1'"'"'; \
245
for (split(/(?<!\\)$$/m)) { \
246
s/^[^:]+:\s*/$$a: /; \
249
map {print "$$_:" unless m/^\\$$/} (split(/\s+/));\
254
wvcc=$(call wvcc_base,$1,$2,$3,$(CC) $(CFLAGS) $($1-CPPFLAGS) $($1-CFLAGS) $4,$(if $5,$5,-c))
255
wvcxx=$(call wvcc_base,$1,$2,$3,$(CXX) $(CFLAGS) $(CXXFLAGS) $($1-CPPFLAGS) $($1-CFLAGS) $($1-CXXFLAGS) $4,$(if $5,$5,-c))
258
$(LINK_MSG)set -e; rm -f $1 $(patsubst %.a,%.libs,$1); \
259
echo $2 >$(patsubst %.a,%.libs,$1); \
260
$(AR) q $1 $(filter %.o,$2); \
261
for d in "" $(filter %.libs,$2); do \
262
if [ "$$d" != "" ]; then \
263
cd $$(dirname "$$d"); \
264
$(AR) q $(shell pwd)/$1 $$(cat $$(basename $$d)); \
110
# usage: $(wvcc,outfile,infile,stem,extra_cflags,mode)
111
# eg: $(wvcc,foo.o,foo.cc,foo,-fPIC,-c)
114
./CC $(if $5,$5,-c) $3 $($1-CFLAGS) $($1-CPPFLAGS) $4
118
./CXX $(if $5,$5,-c) $3 $($1-CXXFLAGS) $($1-CPPFLAGS) $4
270
121
%.so: SONAME=$@$(if $(SO_VERSION),.$(SO_VERSION))
271
123
wvsoname=$(if $($1-SONAME),$($1-SONAME),$(if $(SONAME),$(SONAME),$1))
273
$(LINK_MSG)$(WVLINK_CC) $(LDFLAGS) $($1-LDFLAGS) -Wl,-soname,$(call wvsoname,$1) -shared -o $1 $(filter %.o %.a %.so,$2) $($1-LIBS) $(LIBS) $(XX_LIBS)
126
@echo "Skipping $@ on win32 (can't build shared libraries)"
130
$(LINK_MSG)$(WVLINK_CC) $(LDFLAGS) $($1-LDFLAGS) -Wl,-z,defs -Wl,-soname,$(call wvsoname,$1) -shared -o $1 $(filter %.o %.a %.so,$2) $($1-LIBS) $(LIBS) $(XX_LIBS)
274
131
$(if $(filter-out $(call wvsoname,$1),$1),$(call wvlns,$1,$(call wvsoname,$1)))
277
wvlink=$(LINK_MSG)$(CC) $(LDFLAGS) $($1-LDFLAGS) -o $1 $(filter %.o %.a %.so, $2) $($1-LIBS) $(LIBS) $(XX_LIBS) $(LDLIBS)
279
135
../%.so:; @echo "Shared library $@ does not exist!"; exit 1
280
136
../%.a:; @echo "Library $@ does not exist!"; exit 1
313
# Header files for tcl/tk packages
315
pkgIndex.tcl: $(filter-out pkgIndex.tcl,$(wildcard *.tcl))
316
@echo Generating pkgIndex.tcl...
318
@echo pkg_mkIndex . \
319
$$(echo $^ | sed 's,\.tcl_paths,,') | tclsh
321
pkgIndex.tcl $(wildcard *.tcl): .tcl_paths
323
@echo Generating .tcl_paths...
325
@find . $(TOPDIR) -name '*.tcl' -printf '%h\n' | sort | uniq | \
326
(echo lappend auto_path \\; sed 's/^.*$$/ & \\/'; echo) >$@.tmp
330
169
# We automatically generate header dependencies for .c and .cc files. The
331
# dependencies are stored in the file ".filename.d"
170
# dependencies are stored in the file ".filename.d", and we include them
171
# automatically here if they exist.
333
depfiles_sf = $(wildcard .*.d t/.*.d)
335
ifneq ($(depfiles_sf),)
336
-include $(depfiles_sf)
173
-include $(shell find . -name '.*.d') /dev/null
399
231
@rm -f semantic.cache tags
400
232
@rm -rf debian/tmp
403
# default dist rules.
406
PKGNAME := $(notdir $(shell pwd))
407
PPKGNAME := $(shell echo $(PKGNAME) | tr a-z A-Z | tr - _)
408
PKGVER := $(shell test -f wvver.h \
409
&& cat wvver.h | sed -ne "s/\#define $(PPKGNAME)_VER_STRING.*\"\([^ ]*\).*\".*/\1/p")
411
PKGDIR := $(PKGNAME)-$(PKGVER)
415
ifneq ($(PKGSNAPSHOT),)
416
PKGDIR := $(PKGDIR)+$(shell date +%Y%m%d)
423
dist: dist-hook ChangeLog
236
PKGDIR=$(WVPACKAGE_TARNAME)-$(WVPACKAGE_VERSION)
424
239
@echo '--> Making dist in ../build/$(PKGDIR)...'
425
240
@test -d ../build || mkdir ../build
426
241
@rsync -a --delete --force '$(shell pwd)/' '../build/$(PKGDIR)'
427
@find '../build/$(PKGDIR)' -name .svn -type d -print0 | xargs -0 rm -rf --
428
@find '../build/$(PKGDIR)' -name .cvsignore -type f -print0 | xargs -0 rm -f --
429
@$(MAKE) -C '../build/$(PKGDIR)' distclean
242
cd ../build/$(PKGDIR) && git clean -d -f -x
243
cd ../build/$(PKGDIR) && git log > ChangeLog
244
@find '../build/$(PKGDIR)' -name .git -type d -print0 | xargs -0 rm -rf --
245
@find '../build/$(PKGDIR)' -name .gitignore -type f -print0 | xargs -0 rm -f --
430
246
@rm -f '../build/$(PKGDIR).tar.gz'
431
247
@cd ../build; tar -zcf '$(PKGDIR).tar.gz' '$(PKGDIR)'
432
248
@echo '--> Created tarball in ../build/$(PKGDIR).tar.gz.'
435
@echo '--> Generating ChangeLog from Subversion...'
436
@rm -f ChangeLog ChangeLog.bak
437
@svn log --xml --verbose | xsltproc svn2cl.xsl - > ChangeLog
440
# Make 'tags' file using the ctags program - useful for editing
442
#tags: $(shell find -name '*.cc' -o -name '*.[ch]')
443
# @echo '(creating "tags")'
444
# @if [ -x /usr/bin/ctags ]; then /usr/bin/ctags $^; fi