Makefile 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. # $Id$
  2. #
  3. # sip_router makefile
  4. #
  5. # WARNING: requires gmake (GNU Make)
  6. # Arch supported: Linux, FreeBSD, SunOS (tested on Solaris 8), OpenBSD (3.2),
  7. # NetBSD (1.6).
  8. #
  9. # History:
  10. # --------
  11. # created by andrei
  12. # 2003-02-24 make install no longer overwrites ser.cfg - patch provided
  13. # by Maxim Sobolev <[email protected]> and
  14. # Tomas Björklund <[email protected]>
  15. # 2003-03-11 PREFIX & LOCALBASE must also be exported (andrei)
  16. # 2003-04-07 hacked to work with solaris install (andrei)
  17. # 2003-04-17 exclude modules overwritable from env. or cmd. line,
  18. # added include_modules and skip_modules (andrei)
  19. # 2003-05-30 added extra_defs & EXTRA_DEFS
  20. # Makefile.defs force-included to allow recursive make
  21. # calls -- see comment (andrei)
  22. # 2003-06-02 make tar changes -- unpacks in $NAME-$RELEASE (andrei)
  23. # 2003-06-03 make install-cfg will properly replace the module path
  24. # in the cfg (re: /usr/.*lib/ser/modules)
  25. # ser.cfg.default is installed only if there is a previous
  26. # cfg. -- fixes packages containing ser.cfg.default (andrei)
  27. # 2003-08-29 install-modules-doc split from install-doc, added
  28. # install-modules-all, removed README.cfg (andrei)
  29. # added skip_cfg_install (andrei)
  30. # 2004-09-02 install-man will automatically "fix" the path of the files
  31. # referred in the man pages
  32. # 2006-02-14 added utils & install-utils (andrei)
  33. # 2006-03-15 added nodeb parameter for make tar (andrei)
  34. # 2006-09-29 added modules-doc as target and doc_format= as make option (greger)
  35. # 2006-12-09 added new group_include as make option and defined groups
  36. # defining which modules to include. Also added new target
  37. # print-modules that you can use to check which modules will be
  38. # compiled (greger)
  39. # 2007-01-10 added new group_include targets mysql, radius, and presence
  40. # improved print-modules output fixed problem in include/exclude
  41. # logic when using group_include (greger)
  42. # 2007-03-01 fail if a module or a required utility make fail unless
  43. # err_fail=0; don't try to make modules with no Makefiles (andrei)
  44. # 2007-03-16 moved the exports to Makefile.defs (andrei)
  45. # 2007-03-29 install-modules changed to use make -C modpath install (andrei)
  46. # 2007-05-04 "if ! foo" not supported in standard sh, switched to
  47. # "if foo; then :; else ... ; fi" (andrei)
  48. # 2008-06-23 added 2 new targets: README and man (re-generate the README
  49. # or manpages for all the modules) (andrei)
  50. # 2008-06-25 make cfg support (use a pre-built cfg.: config.mak) (andrei)
  51. # 2008-06-28 added install-modules-man & error checks for
  52. # install-utils & doc (andrei)
  53. auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc
  54. auto_gen_others=cfg.tab.h # auto generated, non-c
  55. #include source related defs
  56. include Makefile.sources
  57. # whether or not the entire build process should fail if building a module or
  58. # an utility fails
  59. err_fail?=1
  60. # whether or not to install ser.cfg or just ser.cfg.default
  61. # (ser.cfg will never be overwritten by make install, this is usefull
  62. # when creating packages)
  63. skip_cfg_install?=
  64. #extra modules to exclude
  65. skip_modules?=
  66. # Set document format
  67. # Alternatives are txt, html, xhtml, and pdf (see Makefile.doc)
  68. doc_format?=html
  69. # Module group definitions, default only include the standard group
  70. # Make backwards compatible, don't set group_include default...
  71. #group_include?="standard"
  72. # Modules in this group are considered a standard part of SER (due to
  73. # widespread usage) and have no external compile or link dependencies (note
  74. # that some of these interplay with external systems).
  75. module_group_standard=acc_syslog auth avp avpops ctl dispatcher diversion enum\
  76. eval exec fifo flatstore gflags maxfwd mediaproxy \
  77. nathelper options pdt permissions pike print ratelimit \
  78. registrar rr sanity sl textops timer tm uac unixsock uri \
  79. usrloc xlog cfg_rpc
  80. # Modules in this group are considered a standard part of SER (due to
  81. # widespread usage) but they have dependencies that must be satisfied for
  82. # compilation.
  83. # acc_radius, auth_radius, avp_radius, uri_radius => radiusclient-ng
  84. # acc_db, auth_db, avp_db, db_ops, domain, lcr, msilo, dialog, speeddial,
  85. # uri_db => database module (mysql, postgres, dbtext)
  86. # mysql, postgres => mysql server and client libraries or postgres server and
  87. # client libraries or other database back-end (ex. mysql-devel)
  88. # pa, xmlrpc => libxml2
  89. # rls => pa
  90. #
  91. # NOTE! All presence modules (dialog, pa, presence_b2b, rls, xcap) have been
  92. # included in this group due to interdependencies
  93. module_group_standard_dep=acc_db acc_radius auth_db auth_radius avp_db \
  94. avp_radius \
  95. db_ops domain lcr msilo mysql dialog pa postgres \
  96. presence_b2b rls speeddial uri_db xcap xmlrpc
  97. # For mysql
  98. module_group_mysql=acc_db auth_db avp_db db_ops uri_db domain lcr msilo mysql\
  99. speeddial
  100. # For radius
  101. module_group_radius=acc_radius auth_radius avp_radius
  102. # For presence
  103. module_group_presence=dialog pa presence_b2b rls xcap
  104. # Modules in this group satisfy specific or niche applications, but are
  105. # considered stable for production use. They may or may not have dependencies
  106. # cpl-c => libxml2
  107. # jabber => expat (library)
  108. # osp => OSP Toolkit (sipfoundry)
  109. # sms => none (external modem)
  110. module_group_stable=cpl-c dbtext jabber osp sms
  111. # Modules in this group are either not complete, untested, or without enough
  112. # reports of usage to allow the module into the stable group. They may or may
  113. # not have dependencies
  114. module_group_experimental=tls oracle iptrtpproxy
  115. # if not set on the cmd. line or the env, exclude the below modules.
  116. ifneq ($(group_include),)
  117. # For group_include, default all modules are excluded except those in
  118. # include_modules
  119. exclude_modules?=
  120. else
  121. # Old defaults for backwards compatibility
  122. exclude_modules?= acc cpl ext extcmd radius_acc radius_auth vm\
  123. group mangler auth_diameter \
  124. postgres snmp \
  125. im \
  126. jabber mysql \
  127. cpl-c \
  128. auth_radius group_radius uri_radius avp_radius \
  129. acc_radius dialog pa rls presence_b2b xcap xmlrpc\
  130. osp tls oracle \
  131. unixsock dbg print_lib auth_identity ldap
  132. # excluded because they do not compile (remove them only after they are
  133. # fixed) -- andrei
  134. exclude_modules+= avpops bdb dbtext iptrtpproxy
  135. endif
  136. # always exclude the CVS dir
  137. override exclude_modules+= CVS $(skip_modules)
  138. # Test for the groups and add to include_modules
  139. ifneq (,$(findstring standard,$(group_include)))
  140. override include_modules+= $(module_group_standard)
  141. endif
  142. ifneq (,$(findstring standard-dep,$(group_include)))
  143. override include_modules+= $(module_group_standard_dep)
  144. endif
  145. ifneq (,$(findstring mysql,$(group_include)))
  146. override include_modules+= $(module_group_mysql)
  147. endif
  148. ifneq (,$(findstring radius,$(group_include)))
  149. override include_modules+= $(module_group_radius)
  150. endif
  151. ifneq (,$(findstring presence,$(group_include)))
  152. override include_modules+= $(module_group_presence)
  153. endif
  154. ifneq (,$(findstring stable,$(group_include)))
  155. override include_modules+= $(module_group_stable)
  156. endif
  157. ifneq (,$(findstring experimental,$(group_include)))
  158. override include_modules+= $(module_group_experimental)
  159. endif
  160. # first 2 lines are excluded because of the experimental or incomplete
  161. # status of the modules
  162. # the rest is excluded because it depends on external libraries
  163. #
  164. static_modules=
  165. ALLDEP=config.mak Makefile Makefile.sources Makefile.rules
  166. #include general defs (like CC, CFLAGS a.s.o)
  167. # hack to force makefile.defs re-inclusion (needed when make calls itself with
  168. # other options -- e.g. make bin)
  169. #makefile_defs=0
  170. #DEFS:=
  171. # try saved cfg, unless we are in the process of building it
  172. ifeq (,$(filter config.mak config cfg,$(MAKECMDGOALS)))
  173. include config.mak
  174. ifeq ($(makefile_defs),1)
  175. $(info config.mak loaded)
  176. # config_make valid & used
  177. config_mak=1
  178. endif
  179. else
  180. ifneq (,$(filter cfg config,$(word 1,$(MAKECMDGOALS))))
  181. # needed here to avoid starting a config submake
  182. # (e.g. rm -f config.mak; make config.mak), which would either require
  183. # double Makefile.defs defines execution (suboptimal), would loose
  184. # $(value ...) expansion or would cause some warning (if Makefile.defs exec.
  185. # is skipped in the "main" makefile invocation).
  186. $(shell rm -rf config.mak)
  187. endif
  188. endif
  189. main_makefile=1
  190. include Makefile.defs
  191. static_modules_path=$(addprefix modules/, $(static_modules))
  192. extra_sources=$(wildcard $(addsuffix /*.c, $(static_modules_path)))
  193. extra_objs=$(extra_sources:.c=.o)
  194. static_defs= $(foreach mod, $(static_modules), \
  195. -DSTATIC_$(shell echo $(mod) | tr [:lower:] [:upper:]) )
  196. override extra_defs+=$(static_defs) $(EXTRA_DEFS)
  197. export extra_defs
  198. # Historically, the resultant set of modules is: modules/* - exclude_modules +
  199. # include_modules
  200. # When group_include is used, we want: include_modules (based on group_include)
  201. # - exclude_modules
  202. ifneq ($(modules_configured),1)
  203. ifneq ($(group_include),)
  204. modules=$(filter-out $(addprefix modules/, \
  205. $(exclude_modules) $(static_modules)), \
  206. $(addprefix modules/, $(include_modules) ))
  207. else
  208. # Standard, old resultant set
  209. modules_all=$(filter-out CVS, $(wildcard modules/*))
  210. modules_noinc=$(filter-out $(addprefix modules/, \
  211. $(exclude_modules) $(static_modules)), $(modules_all))
  212. modules=$(filter-out $(modules_noinc), \
  213. $(addprefix modules/, $(include_modules) )) $(modules_noinc)
  214. endif # ifneq($(group_include),)
  215. endif # ifneq($(modules_configured),1)
  216. modules_names=$(shell echo $(modules)| \
  217. sed -e 's/modules\/\([^/ ]*\)\/*/\1.so/g' )
  218. modules_basenames=$(shell echo $(modules)| \
  219. sed -e 's/modules\/\([^/ ]*\)\/*/\1/g' )
  220. #modules_names=$(patsubst modules/%, %.so, $(modules))
  221. #modules_full_path=$(join $(modules), $(addprefix /, $(modules_names)))
  222. # which utils need compilation (directory path) and which to install
  223. # (full path including file name)
  224. utils_compile= utils/gen_ha1 utils/sercmd
  225. utils_bin_install= utils/gen_ha1/gen_ha1 utils/sercmd/sercmd
  226. utils_script_install=
  227. # This is the list of files to be installed into the arch-independent
  228. # shared directory (by default /usr/local/share/ser)
  229. share_install= scripts/mysql/my_create.sql \
  230. scripts/mysql/my_data.sql \
  231. scripts/mysql/my_drop.sql
  232. NAME=$(MAIN_NAME)
  233. tar_name=$(NAME)-$(RELEASE)_src
  234. tar_extra_args+=$(addprefix --exclude=$(notdir $(CURDIR))/, \
  235. $(auto_gen) $(auto_gen_others))
  236. ifeq ($(CORE_TLS), 1)
  237. tar_extra_args+=
  238. else
  239. tar_extra_args+=--exclude=$(notdir $(CURDIR))/tls/*
  240. endif
  241. ifneq ($(nodeb),)
  242. tar_extra_args+=--exclude=$(notdir $(CURDIR))/debian
  243. tar_name:=$(tar_name)_nodeb
  244. endif
  245. # sanity checks
  246. ifneq ($(TLS),)
  247. $(warning "make TLS option is obsoleted, try TLS_HOOKS or CORE_TLS")
  248. endif
  249. # include the common rules
  250. include Makefile.targets
  251. include Makefile.rules
  252. #extra targets
  253. $(NAME): $(extra_objs) # static_modules
  254. lex.yy.c: cfg.lex cfg.tab.h $(ALLDEP)
  255. $(LEX) $<
  256. cfg.tab.c cfg.tab.h: cfg.y $(ALLDEP)
  257. $(YACC) $(YACC_FLAGS) $<
  258. include Makefile.shared
  259. ifeq ($(config_mak),1)
  260. COREPATH=.
  261. include Makefile.cfg
  262. else
  263. config.mak: Makefile.defs
  264. @echo making config...
  265. @echo "# this file is autogenerated by make cfg" >$@
  266. @echo "# `date`" >>$@
  267. @$(call mapf2,cfg_save_var,saved_fixed_vars,$(@))
  268. @$(call mapf2,cfg_save_var2,saved_chg_vars,$(@))
  269. @echo "override makefile_defs:=1" >>$@
  270. @$(call cfg_save_var2,group_include,$@)
  271. @$(call cfg_save_var2,include_modules,$@)
  272. @$(call cfg_save_var2,static_modules,$@)
  273. @$(call cfg_save_var2,skip_modules,$@)
  274. @$(call cfg_save_var2,exclude_modules,$@)
  275. @$(call cfg_save_var2,modules_all,$@)
  276. @$(call cfg_save_var2,modules_noinc,$@)
  277. @$(call cfg_save_var2,modules,$@)
  278. @echo "modules_configured:=1" >>$@
  279. @echo "DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(DEFS))" \
  280. "\$$(extra_defs)" >>$@
  281. @echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \
  282. "\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@
  283. endif # ifeq ($(config_mak),1)
  284. .PHONY: cfg config
  285. cfg config: config.mak
  286. #rm -f config.mak
  287. #$(MAKE) config.mak exported_vars=0
  288. .PHONY: all
  289. all: $(NAME) modules
  290. .PHONY: print-modules
  291. print-modules:
  292. @echo The following modules were chosen to be included: \
  293. $(include_modules) ; \
  294. echo ---------------------------------------------------------- ; \
  295. echo The following modules will be excluded: $(exclude_modules) ; \
  296. echo ---------------------------------------------------------- ; \
  297. echo The following modules will be made: $(modules_basenames) ; \
  298. .PHONY: modules
  299. modules:
  300. @for r in $(modules) "" ; do \
  301. if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
  302. echo "" ; \
  303. echo "" ; \
  304. if $(MAKE) -C $$r || [ ${err_fail} != 1 ] ; then \
  305. :; \
  306. else \
  307. exit 1; \
  308. fi ; \
  309. fi ; \
  310. done; true
  311. $(extra_objs):
  312. @echo "Extra objs: $(extra_objs)"
  313. @for r in $(static_modules_path) "" ; do \
  314. if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
  315. echo "" ; \
  316. echo "Making static module $r" ; \
  317. if $(MAKE) -C $$r static ; then \
  318. :; \
  319. else \
  320. exit 1; \
  321. fi ; \
  322. fi ; \
  323. done
  324. .PHONY: utils
  325. utils:
  326. @for r in $(utils_compile) "" ; do \
  327. if [ -n "$$r" ]; then \
  328. echo "" ; \
  329. echo "" ; \
  330. if $(MAKE) -C $$r || [ ${err_fail} != 1 ] ; then \
  331. :; \
  332. else \
  333. exit 1; \
  334. fi ; \
  335. fi ; \
  336. done; true
  337. dbg: ser
  338. gdb -command debug.gdb
  339. .PHONY: tar
  340. .PHONY: dist
  341. dist: tar
  342. tar:
  343. $(TAR) -C .. \
  344. --exclude=$(notdir $(CURDIR))/test* \
  345. --exclude=$(notdir $(CURDIR))/tmp* \
  346. --exclude=$(notdir $(CURDIR))/debian/ser \
  347. --exclude=$(notdir $(CURDIR))/debian/ser-* \
  348. --exclude=$(notdir $(CURDIR))/ser_tls* \
  349. --exclude=CVS* \
  350. --exclude=.svn* \
  351. --exclude=.cvsignore \
  352. --exclude=librpath.lst \
  353. --exclude=libiname.lst \
  354. --exclude=makecfg.lst \
  355. --exclude=config.mak \
  356. --exclude=*.[do] \
  357. --exclude=*.so \
  358. --exclude=*.il \
  359. --exclude=$(notdir $(CURDIR))/ser \
  360. --exclude=*.gz \
  361. --exclude=*.bz2 \
  362. --exclude=*.tar \
  363. --exclude=*.patch \
  364. --exclude=.\#* \
  365. --exclude=*.swp \
  366. ${tar_extra_args} \
  367. -cf - $(notdir $(CURDIR)) | \
  368. (mkdir -p tmp/_tar1; mkdir -p tmp/_tar2 ; \
  369. cd tmp/_tar1; $(TAR) -xf - ) && \
  370. mv tmp/_tar1/$(notdir $(CURDIR)) \
  371. tmp/_tar2/"$(NAME)-$(RELEASE)" && \
  372. (cd tmp/_tar2 && $(TAR) \
  373. -zcf ../../"$(tar_name)".tar.gz \
  374. "$(NAME)-$(RELEASE)" ) ; \
  375. rm -rf tmp/_tar1; rm -rf tmp/_tar2
  376. # binary dist. tar.gz
  377. .PHONY: bin
  378. bin:
  379. mkdir -p tmp/ser/usr/local
  380. $(MAKE) install basedir=tmp/ser
  381. $(TAR) -C tmp/ser/ -zcf ../$(NAME)-$(RELEASE)_$(OS)_$(ARCH).tar.gz .
  382. rm -rf tmp/ser
  383. .PHONY: deb
  384. deb:
  385. -@if [ -d debian ]; then \
  386. dpkg-buildpackage -rfakeroot -tc; \
  387. else \
  388. ln -s pkg/debian debian; \
  389. dpkg-buildpackage -rfakeroot -tc; \
  390. rm debian; \
  391. fi
  392. .PHONY: sunpkg
  393. sunpkg:
  394. mkdir -p tmp/ser
  395. mkdir -p tmp/ser_sun_pkg
  396. $(MAKE) install basedir=tmp/ser prefix=/usr/local
  397. (cd pkg/solaris; \
  398. pkgmk -r ../../tmp/ser/usr/local -o -d ../../tmp/ser_sun_pkg/ -v "$(RELEASE)" ;\
  399. cd ../..)
  400. cat /dev/null > ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
  401. pkgtrans -s tmp/ser_sun_pkg/ ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local \
  402. IPTELser
  403. gzip -9 ../$(NAME)-$(RELEASE)-$(OS)-$(ARCH)-local
  404. rm -rf tmp/ser
  405. rm -rf tmp/ser_sun_pkg
  406. .PHONY: modules-doc
  407. modules-doc:
  408. -@for r in $(modules) "" ; do \
  409. if [ -n "$$r" ]; then \
  410. echo "" ; \
  411. echo "" ; \
  412. $(MAKE) -C $$r/doc $(doc_format) ; \
  413. fi ; \
  414. done
  415. .PHONY: modules-readme
  416. modules-readme: README
  417. .PHONY: README
  418. README:
  419. -@for r in $(modules) "" ; do \
  420. if [ -n "$$r" ]; then \
  421. echo "" ; \
  422. echo "" ; \
  423. if $(MAKE) -C $$r README || [ ${err_fail} != 1 ] ; then \
  424. :; \
  425. else \
  426. exit 1; \
  427. fi ; \
  428. fi ; \
  429. done; true
  430. .PHONY: modules-man
  431. modules-man: man
  432. .PHONY: man
  433. man:
  434. -@for r in $(modules) "" ; do \
  435. if [ -n "$$r" ]; then \
  436. echo "" ; \
  437. echo "" ; \
  438. if $(MAKE) -C $$r man || [ ${err_fail} != 1 ] ; then \
  439. :; \
  440. else \
  441. exit 1; \
  442. fi ; \
  443. fi ; \
  444. done; true
  445. .PHONY: install
  446. install:all install-bin install-modules install-cfg \
  447. install-doc install-man install-utils install-share
  448. .PHONY: dbinstall
  449. dbinstall:
  450. -@echo "Initializing ser database"
  451. scripts/mysql/ser_mysql.sh create
  452. -@echo "Done"
  453. mk-install_dirs: $(cfg_prefix)/$(cfg_dir) $(bin_prefix)/$(bin_dir) \
  454. $(modules_prefix)/$(modules_dir) $(doc_prefix)/$(doc_dir) \
  455. $(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5 \
  456. $(share_prefix)/$(share_dir)
  457. $(cfg_prefix)/$(cfg_dir):
  458. mkdir -p $(cfg_prefix)/$(cfg_dir)
  459. $(bin_prefix)/$(bin_dir):
  460. mkdir -p $(bin_prefix)/$(bin_dir)
  461. $(share_prefix)/$(share_dir):
  462. mkdir -p $(share_prefix)/$(share_dir)
  463. $(modules_prefix)/$(modules_dir):
  464. mkdir -p $(modules_prefix)/$(modules_dir)
  465. $(doc_prefix)/$(doc_dir):
  466. mkdir -p $(doc_prefix)/$(doc_dir)
  467. $(man_prefix)/$(man_dir)/man8:
  468. mkdir -p $(man_prefix)/$(man_dir)/man8
  469. $(man_prefix)/$(man_dir)/man7:
  470. mkdir -p $(man_prefix)/$(man_dir)/man7
  471. $(man_prefix)/$(man_dir)/man5:
  472. mkdir -p $(man_prefix)/$(man_dir)/man5
  473. # note: sed with POSIX.1 regex doesn't support |, + or ? (darwin, solaris ...)
  474. install-cfg: $(cfg_prefix)/$(cfg_dir)
  475. sed -e "s#/usr/.*lib/ser/modules/#$(modules-target)#g" \
  476. < etc/ser-basic.cfg > $(cfg_prefix)/$(cfg_dir)ser.cfg.sample
  477. chmod 644 $(cfg_prefix)/$(cfg_dir)ser.cfg.sample
  478. if [ -z "${skip_cfg_install}" -a \
  479. ! -f $(cfg_prefix)/$(cfg_dir)ser.cfg ]; then \
  480. mv -f $(cfg_prefix)/$(cfg_dir)ser.cfg.sample \
  481. $(cfg_prefix)/$(cfg_dir)ser.cfg; \
  482. fi
  483. sed -e "s#/usr/.*lib/ser/modules/#$(modules-target)#g" \
  484. < etc/ser-oob.cfg \
  485. > $(cfg_prefix)/$(cfg_dir)ser-advanced.cfg.sample
  486. chmod 644 $(cfg_prefix)/$(cfg_dir)ser-advanced.cfg.sample
  487. if [ -z "${skip_cfg_install}" -a \
  488. ! -f $(cfg_prefix)/$(cfg_dir)ser-advanced.cfg ]; then \
  489. mv -f $(cfg_prefix)/$(cfg_dir)ser-advanced.cfg.sample \
  490. $(cfg_prefix)/$(cfg_dir)ser-advanced.cfg; \
  491. fi
  492. # radius dictionary
  493. $(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.ser
  494. $(INSTALL_CFG) etc/dictionary.ser $(cfg_prefix)/$(cfg_dir)
  495. # TLS configuration
  496. $(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/tls.cfg
  497. $(INSTALL_CFG) modules/tls/tls.cfg $(cfg_prefix)/$(cfg_dir)
  498. modules/tls/ser_cert.sh -d $(cfg_prefix)/$(cfg_dir)
  499. install-bin: $(bin_prefix)/$(bin_dir) $(NAME)
  500. $(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/$(NAME)
  501. $(INSTALL_BIN) $(NAME) $(bin_prefix)/$(bin_dir)
  502. install-share: $(share_prefix)/$(share_dir)
  503. @for r in $(share_install) "" ; do \
  504. if [ -n "$$r" ]; then \
  505. if [ -f "$$r" ]; then \
  506. $(call try_err, $(INSTALL_TOUCH) \
  507. $(share_prefix)/$(share_dir)/`basename "$$r"` ); \
  508. $(call try_err, \
  509. $(INSTALL_SHARE) "$$r" $(share_prefix)/$(share_dir) );\
  510. else \
  511. echo "ERROR: $$r not found" ; \
  512. if [ ${err_fail} = 1 ] ; then \
  513. exit 1; \
  514. fi ; \
  515. fi ;\
  516. fi ; \
  517. done; true
  518. install-modules: $(modules_prefix)/$(modules_dir)
  519. @for r in $(modules) "" ; do \
  520. if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
  521. echo "" ; \
  522. echo "" ; \
  523. if $(MAKE) -C $$r install || [ ${err_fail} != 1 ] ; then \
  524. :; \
  525. else \
  526. exit 1; \
  527. fi ; \
  528. fi ; \
  529. done; true
  530. install-utils: utils $(bin_prefix)/$(bin_dir)
  531. @for r in $(utils_bin_install) "" ; do \
  532. if [ -n "$$r" ]; then \
  533. if [ -f "$$r" ]; then \
  534. $(call try_err, $(INSTALL_TOUCH) \
  535. $(bin_prefix)/$(bin_dir)/`basename "$$r"` ); \
  536. $(call try_err,\
  537. $(INSTALL_BIN) "$$r" $(bin_prefix)/$(bin_dir) ); \
  538. else \
  539. echo "ERROR: $$r not compiled" ; \
  540. if [ ${err_fail} = 1 ] ; then \
  541. exit 1; \
  542. fi ; \
  543. fi ;\
  544. fi ; \
  545. done; true
  546. @for r in $(utils_script_install) "" ; do \
  547. if [ -n "$$r" ]; then \
  548. if [ -f "$$r" ]; then \
  549. $(call try_err, $(INSTALL_TOUCH) \
  550. $(bin_prefix)/$(bin_dir)/`basename "$$r"` ); \
  551. $(call try_err,\
  552. $(INSTALL_SCRIPT) "$$r" $(bin_prefix)/$(bin_dir) ); \
  553. else \
  554. echo "ERROR: $$r not compiled" ; \
  555. if [ ${err_fail} = 1 ] ; then \
  556. exit 1; \
  557. fi ; \
  558. fi ;\
  559. fi ; \
  560. done; true
  561. # FIXME: This is a hack, this should be (and will be) done properly in
  562. # per-module Makefiles
  563. sed -e "s#^DEFAULT_SCRIPT_DIR.*#DEFAULT_SCRIPT_DIR=\"$(share_prefix)/$(share_dir)\"#g" \
  564. < scripts/mysql/ser_mysql.sh > $(bin_prefix)/$(bin_dir)/ser_mysql.sh
  565. chmod 755 $(bin_prefix)/$(bin_dir)/ser_mysql.sh
  566. install-modules-all: install-modules install-modules-doc
  567. install-doc: $(doc_prefix)/$(doc_dir) install-modules-doc
  568. $(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/INSTALL
  569. $(INSTALL_DOC) INSTALL $(doc_prefix)/$(doc_dir)
  570. $(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/README-MODULES
  571. $(INSTALL_DOC) README-MODULES $(doc_prefix)/$(doc_dir)
  572. $(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/AUTHORS
  573. $(INSTALL_DOC) AUTHORS $(doc_prefix)/$(doc_dir)
  574. $(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/NEWS
  575. $(INSTALL_DOC) NEWS $(doc_prefix)/$(doc_dir)
  576. $(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/README
  577. $(INSTALL_DOC) README $(doc_prefix)/$(doc_dir)
  578. install-modules-doc: $(doc_prefix)/$(doc_dir)
  579. @for r in $(modules_basenames) "" ; do \
  580. if [ -n "$$r" ]; then \
  581. if [ -f modules/"$$r"/README ]; then \
  582. $(call try_err,\
  583. $(INSTALL_TOUCH) $(doc_prefix)/$(doc_dir)/README ); \
  584. $(call try_err,\
  585. $(INSTALL_DOC) modules/"$$r"/README \
  586. $(doc_prefix)/$(doc_dir)/README ); \
  587. $(call try_err,\
  588. mv -f $(doc_prefix)/$(doc_dir)/README \
  589. $(doc_prefix)/$(doc_dir)/README."$$r" ); \
  590. fi ; \
  591. fi ; \
  592. done; true
  593. install-ser-man: $(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5
  594. sed -e "s#/etc/ser/ser\.cfg#$(cfg_target)ser.cfg#g" \
  595. -e "s#/usr/sbin/#$(bin_target)#g" \
  596. -e "s#/usr/lib/ser/modules/#$(modules_target)#g" \
  597. -e "s#/usr/share/doc/ser/#$(doc_target)#g" \
  598. < ser.8 > $(man_prefix)/$(man_dir)/man8/ser.8
  599. chmod 644 $(man_prefix)/$(man_dir)/man8/ser.8
  600. sed -e "s#/etc/ser/ser\.cfg#$(cfg_target)ser.cfg#g" \
  601. -e "s#/usr/sbin/#$(bin_target)#g" \
  602. -e "s#/usr/lib/ser/modules/#$(modules_target)#g" \
  603. -e "s#/usr/share/doc/ser/#$(doc_target)#g" \
  604. < ser.cfg.5 > $(man_prefix)/$(man_dir)/man5/ser.cfg.5
  605. chmod 644 $(man_prefix)/$(man_dir)/man5/ser.cfg.5
  606. install-man: install-ser-man install-modules-man
  607. install-modules-man: modules-man $(man_prefix)/$(man_dir)/man7
  608. @for r in $(modules_basenames) "" ; do \
  609. if [ -n "$$r" ]; then \
  610. if [ -f modules/"$$r"/"$$r".7 ]; then \
  611. $(call try_err,\
  612. $(INSTALL_TOUCH) $(man_prefix)/$(man_dir)/man7/"$$r".7 );\
  613. $(call try_err,\
  614. $(INSTALL_MAN) modules/"$$r"/"$$r".7 \
  615. $(man_prefix)/$(man_dir)/man7 ); \
  616. fi ; \
  617. fi ; \
  618. done; true
  619. .PHONY: clean_libs
  620. clean_libs:
  621. $(MAKE) -C lib proper
  622. # cleaning in libs always when cleaning ser
  623. clean: clean_libs
  624. proper realclean distclean: clean_cfg
  625. .PHONY: clean_cfg
  626. clean_cfg:
  627. rm -f config.mak