Makefile
e60a9728
 # $Id$
 #
 # sip_router makefile
 #
1b1b19d8
 # WARNING: requires gmake (GNU Make)
c1aeab16
 #  Arch supported: Linux, FreeBSD, SunOS (tested on Solaris 6), WinNT (cygwin)
e60a9728
 
96001c50
 auto_gen=lex.yy.c cfg.tab.c   #lexx, yacc etc
247c2b65
 
 #include  source related defs
 include Makefile.sources
 
db1b5017
 exclude_modules=CVS mysql pike
c64e586d
 static_modules=
404073d3
 static_modules_path=$(addprefix modules/, $(static_modules))
 extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path)))
 extra_objs=$(extra_sources:.c=.o)
 
 static_defs= $(foreach  mod, $(static_modules), \
af9d50fc
 		-DSTATIC_$(shell echo $(mod) | tr [:lower:] [:upper:]) )
404073d3
 DEFS+=$(static_defs)
 modules=$(filter-out $(addprefix modules/, \
 			$(exclude_modules) $(static_modules)), \
 			$(wildcard modules/*))
6ac71d10
 modules_names=$(shell echo $(modules)| \
 				sed -e 's/modules\/\([^/ ]*\)\/*/\1.so/g' )
 #modules_names=$(patsubst modules/%, %.so, $(modules))
 modules_full_path=$(join  $(modules), $(addprefix /, $(modules_names)))
e60a9728
 
f20a56a2
 NAME=ser
e60a9728
 
247c2b65
 ALLDEP=Makefile Makefile.sources Makefile.defs Makefile.rules
f8734075
 
247c2b65
 #include general defs (like CC, CFLAGS  a.s.o)
 include Makefile.defs
0ae4dfdc
 
247c2b65
 #export relevant variables to the sub-makes
 export DEFS PROFILE CC  LD MKDEP MKTAGS CFLAGS LDFLAGS MOD_CFLAGS MOD_LDFLAGS
 export LEX YACC YACC_FLAGS
0ae4dfdc
 
04bb7a49
 
247c2b65
 # include the common rules
 include Makefile.rules
e60a9728
 
247c2b65
 #extra targets 
3e429f5c
 
04bb7a49
 $(NAME): static_modules
 
a15c363f
 lex.yy.c: cfg.lex $(ALLDEP)
 	$(LEX) $<
 
f8734075
 cfg.tab.c: cfg.y $(ALLDEP)
a15c363f
 	$(YACC) $(YACC_FLAGS) $<
 
e60a9728
 .PHONY: all
96001c50
 all: $(NAME) modules
e60a9728
 
404073d3
 
96001c50
 
 .PHONY: modules
 modules:
e7a9bd30
 	-@for r in $(modules) "" ; do \
 		if [ -n "$$r" ]; then \
 			echo  "" ; \
 			echo  "" ; \
 			$(MAKE) -C $$r ; \
 		fi ; \
 	done 
404073d3
 
 .PHONY: static_modules
 static_modules:
e7a9bd30
 	-@echo "Extra objs: $(extra_objs)" 
 	-@for r in $(static_modules_path) "" ; do \
 		if [ -n "$$r" ]; then \
 			echo  "" ; \
 			echo  "Making static module $r" ; \
 			$(MAKE) -C $$r static ; \
 		fi ; \
 	done 
404073d3
 
 
247c2b65
 	
f571aa35
 dbg: ser
 	gdb -command debug.gdb
247c2b65
 
 
 tar: mantainer-clean 
 	tar -C .. -zcf ../$(NAME)-$(RELEASE)_src.tar.gz  $(notdir $(CURDIR)) 
04bb7a49
 
 
db1b5017
 install: all mk-install-dirs install-cfg install-bin install-modules \
6ac71d10
 	install-doc install-man
db1b5017
 
 
 mk-install-dirs: $(cfg-prefix)/$(cfg-dir) $(bin-prefix)/$(bin-dir) \
6ac71d10
 			$(modules-prefix)/$(modules-dir) $(doc-prefix)/$(doc-dir) \
 			$(man-prefix)/$(man-dir)/man8 $(man-prefix)/$(man-dir)/man5
db1b5017
 
 $(cfg-prefix)/$(cfg-dir): 
 		mkdir -p $(cfg-prefix)/$(cfg-dir)
 
 $(bin-prefix)/$(bin-dir):
 		mkdir -p $(bin-prefix)/$(bin-dir)
 
 $(modules-prefix)/$(modules-dir):
 		mkdir -p $(modules-prefix)/$(modules-dir)
 
 
 $(doc-prefix)/$(doc-dir):
 		mkdir -p $(doc-prefix)/$(doc-dir)
 
6ac71d10
 $(man-prefix)/$(man-dir)/man8:
 		mkdir -p $(man-prefix)/$(man-dir)/man8
 
 $(man-prefix)/$(man-dir)/man5:
 		mkdir -p $(man-prefix)/$(man-dir)/man5
db1b5017
 
 install-cfg:
 		$(INSTALL-CFG) ser.cfg $(cfg-prefix)/$(cfg-dir)
 
 install-bin:
 		$(INSTALL-BIN) ser $(bin-prefix)/$(bin-dir)
 
 
 install-modules:
 	-@for r in $(modules_full_path) "" ; do \
 		if [ -n "$$r" ]; then \
 			$(INSTALL-MODULES)  $$r  $(modules-prefix)/$(modules-dir) ; \
 		fi ; \
 	done 
 
 
 install-doc:
 	$(INSTALL-DOC) README $(doc-prefix)/$(doc-dir)
 
6ac71d10
 install-man:
 	$(INSTALL-MAN)  ser.8 $(man-prefix)/$(man-dir)/man8
 	$(INSTALL-MAN)  ser.cfg.5 $(man-prefix)/$(man-dir)/man5
db1b5017