2007-04-15 19:26:34 +02:00
#!/usr/bin/make
2008-10-14 17:50:37 +02:00
# Example and real root installation
EXAMPLEROOT = ` pwd ` /example/
REALROOT = $( EXAMPLEROOT)
2008-10-03 18:12:36 +02:00
# Subfolders
2008-10-14 17:50:37 +02:00
SYSTEMCONFDIR = $( EXAMPLEROOT) etc/lemonldap-ng/
SCRIPTSDIR = $( EXAMPLEROOT) var/lib/lemonldap-ng/
2008-10-03 18:12:36 +02:00
# DNS Domain for cookie and virtual hosts
DNSDOMAIN = "example.com"
# LDAP parameters
LDAPHOST = "localhost"
LDAPPORT = "389"
2008-10-13 22:52:43 +02:00
LDAPSUFFIX = "dc=example,dc=net"
2008-10-03 18:12:36 +02:00
# Other
2007-09-22 13:34:29 +02:00
VERSION = ` head -n1 changelog | sed -e 's/lemonldap-ng (//' -e 's/).*$$//' `
2008-11-17 17:59:56 +01:00
SRCCOMMONDIR = lemonldap-ng-common
2008-10-03 18:12:36 +02:00
SRCHANDLERDIR = lemonldap-ng-handler
SRCPORTALDIR = lemonldap-ng-portal
SRCMANAGERDIR = lemonldap-ng-manager
EXAMPLELANG = en # For static Manager only
2008-10-13 22:52:43 +02:00
DESTFILECONFDIR = $( SYSTEMCONFDIR) conf/
2008-10-03 18:12:36 +02:00
DESTSESSIONDIR = $( SCRIPTSDIR) sessions/
DESTLASPDIR = $( SCRIPTSDIR) liberty-alliance-sp-portal
DESTPORTALDIR = $( SCRIPTSDIR) portal/
DESTHANDLERDIR = $( SCRIPTSDIR) handler/
DESTMANAGERDIR = $( SCRIPTSDIR) manager/
DESTDOCSDIR = $( SCRIPTSDIR) docs/
2008-10-14 17:50:37 +02:00
# Real directories for file content substitution
REALSYSTEMCONFDIR = $( REALROOT) etc/lemonldap-ng/
REALSCRIPTSDIR = $( REALROOT) var/lib/lemonldap-ng/
REALDESTFILECONFDIR = $( REALSYSTEMCONFDIR) conf/
REALDESTSESSIONDIR = $( REALSCRIPTSDIR) sessions/
REALDESTLASPDIR = $( REALSCRIPTSDIR) liberty-alliance-sp-portal
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
all : common handler manager portal
common : common_conf
@$( MAKE) -C ${ SRCCOMMONDIR }
@touch common
2007-04-15 19:26:34 +02:00
handler : handler_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR }
2008-10-13 22:52:43 +02:00
@touch handler
2007-04-15 19:26:34 +02:00
portal : portal_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR }
2008-10-13 22:52:43 +02:00
@touch portal
2007-04-15 19:26:34 +02:00
manager : manager_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR }
2008-10-13 22:52:43 +02:00
@touch manager
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
configure : common_conf handler_conf portal_conf manager_conf
common_conf :
@cd ${ SRCCOMMONDIR } ; perl Makefile.PL INSTALLDIRS = $( INSTALLDIRS)
@touch common_conf
2007-04-15 19:26:34 +02:00
handler_conf :
2008-11-11 20:06:46 +01:00
@cd ${ SRCHANDLERDIR } ; perl Makefile.PL INSTALLDIRS = $( INSTALLDIRS)
2008-10-13 22:52:43 +02:00
@touch handler_conf
2007-04-15 19:26:34 +02:00
portal_conf :
2008-11-11 20:06:46 +01:00
@cd ${ SRCPORTALDIR } ; perl Makefile.PL INSTALLDIRS = $( INSTALLDIRS)
2008-10-13 22:52:43 +02:00
@touch portal_conf
2007-04-15 19:26:34 +02:00
manager_conf :
2008-11-11 20:06:46 +01:00
@cd ${ SRCMANAGERDIR } ; perl Makefile.PL INSTALLDIRS = $( INSTALLDIRS)
2008-10-13 22:52:43 +02:00
@touch manager_conf
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
test : common handler portal manager common_test handler_test portal_test manager_test
common_test : common
@$( MAKE) -C ${ SRCCOMMONDIR } test
handler_test : handler common_test
@$( MAKE) -C ${ SRCHANDLERDIR } test INST_ARCHLIB = ../${ SRCCOMMONDIR } /blib/lib/
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
portal_test : portal handler_test common_test
@$( MAKE) -C ${ SRCPORTALDIR } test INST_ARCHLIB = ../${ SRCCOMMONDIR } /blib/lib/
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
manager_test : manager handler_test common_test
@$( MAKE) -C ${ SRCMANAGERDIR } test INST_ARCHLIB = ../${ SRCCOMMONDIR } /blib/lib/
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
install : common_install handler_install portal_install manager_install
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
common_install : common
@$( MAKE) -C ${ SRCCOMMONDIR } install
@touch common_install
2007-04-15 19:26:34 +02:00
handler_install : handler
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR } install
2008-10-13 22:52:43 +02:00
@touch handler_install
2007-04-15 19:26:34 +02:00
portal_install : portal
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR } install
2008-10-13 22:52:43 +02:00
@touch portal_install
2007-04-15 19:26:34 +02:00
manager_install : manager
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR } install
2008-10-13 22:52:43 +02:00
@touch manager_install
2007-04-15 19:26:34 +02:00
distclean : clean
2008-11-17 17:59:56 +01:00
clean : common_clean handler_clean portal_clean manager_clean
2008-10-03 18:12:36 +02:00
@rm -rf ${ SYSTEMCONFDIR }
@rm -rf ${ SCRIPTSDIR }
@rm -vf *gz
2007-04-15 19:26:34 +02:00
2008-11-17 17:59:56 +01:00
common_clean :
- $( MAKE) -C ${ SRCCOMMONDIR } distclean
@rm -vf common*
2007-04-15 19:26:34 +02:00
handler_clean :
2008-10-03 18:12:36 +02:00
- $( MAKE) -C ${ SRCHANDLERDIR } distclean
2008-10-13 22:52:43 +02:00
@rm -vf handler*
2007-04-15 19:26:34 +02:00
portal_clean :
2008-10-03 18:12:36 +02:00
- $( MAKE) -C ${ SRCPORTALDIR } distclean
2008-10-13 22:52:43 +02:00
@rm -vf portal*
2007-04-15 19:26:34 +02:00
manager_clean :
2008-10-03 18:12:36 +02:00
- $( MAKE) -C ${ SRCMANAGERDIR } distclean
2008-10-13 22:52:43 +02:00
@rm -vf manager*
2007-04-15 19:26:34 +02:00
example : all
2008-10-03 18:12:36 +02:00
@mkdir -p ${ DESTFILECONFDIR } ${ DESTPORTALDIR } ${ DESTHANDLERDIR } ${ DESTMANAGERDIR } ${ SYSTEMCONFDIR } ${ DESTDOCSDIR } ${ DESTSESSIONDIR }
@cp -a ${ SRCHANDLERDIR } /example/* ${ DESTHANDLERDIR }
@cp -a ${ SRCPORTALDIR } /example/* ${ DESTPORTALDIR }
@rm -rf ${ DESTLASPDIR }
@mv ${ DESTPORTALDIR } AuthLA $$ ( echo ${ DESTLASPDIR } | sed -e 's/\/$$//' )
@cp -a ${ SRCMANAGERDIR } /example/* ${ DESTMANAGERDIR }
@cp -a _example/etc/lemonldap-ng/* ${ SYSTEMCONFDIR }
@cp -a _example/var/lib/lemonldap-ng/* ${ SCRIPTSDIR }
@cp -a doc/* ${ DESTDOCSDIR }
2008-10-14 17:50:37 +02:00
@find ${ DESTLASPDIR } -type f -exec perl -i -pe 's#__DIR__/?#' ${ REALDESTLASPDIR } '#g;s#__CONFDIR__/?#' ${ REALDESTFILECONFDIR } '#g' { } \;
@find ${ SCRIPTSDIR } -type f -exec perl -i -pe 's#__DIR__/?#' ${ REALSCRIPTSDIR } '#g;s#__SYSCONFDIR__/?#' ${ REALSYSTEMCONFDIR } '#g;s#__CONFDIR__/?#' ${ REALDESTFILECONFDIR } '#g;s#__SESSIONDIR__/?#' ${ REALDESTSESSIONDIR } '#g;s#__DNSDOMAIN__#' ${ DNSDOMAIN } '#g;s#__LDAPHOST__#' ${ LDAPHOST } '#g;s#__LDAPPORT__#' ${ LDAPPORT } '#g;s#__LDAPSUFFIX__#' ${ LDAPSUFFIX } '#g;' { } \;
@find ${ SYSTEMCONFDIR } -type f -exec perl -i -pe 's#__DIR__/?#' ${ REALSCRIPTSDIR } '#g;s#__SESSIONDIR__/?#' ${ REALDESTSESSIONDIR } '#g;s#__DNSDOMAIN__#' ${ DNSDOMAIN } '#g;s#__LDAPHOST__#' ${ LDAPHOST } '#g;s#__LDAPPORT__#' ${ LDAPPORT } '#g;s#__LDAPSUFFIX__#' ${ LDAPSUFFIX } '#g;' { } \;
2007-04-15 19:26:34 +02:00
@echo
2008-10-03 18:12:36 +02:00
@echo " LemonLDAP::NG example v ${ VERSION } is installed with these parameters: "
@echo " - System configuration: ${ SYSTEMCONFDIR } "
@echo " - Scripts: ${ SCRIPTSDIR } "
@echo " - LemonLDAP::NG Configuration: ${ DESTFILECONFDIR } "
@echo " - DNS domain (for cookies and virtual hosts): ${ DNSDOMAIN } "
@echo " - LDAP parameters:"
@echo " - Host: ${ LDAPHOST } "
@echo " - Port: ${ LDAPPORT } "
@echo " - Suffix: ${ LDAPSUFFIX } "
@echo
@echo "To finish configuration:"
2007-04-15 19:26:34 +02:00
@echo
@echo "1 - Add this in your Apache configuration file:"
@echo " with Apache-1.3.x"
2008-10-03 18:12:36 +02:00
@echo " include ${ SYSTEMCONFDIR } apache.conf "
2007-04-15 19:26:34 +02:00
@echo " or with Apache-2.x:"
2008-10-03 18:12:36 +02:00
@echo " include ${ SYSTEMCONFDIR } apache2.conf "
2007-04-15 19:26:34 +02:00
@echo
2008-10-03 18:12:36 +02:00
@echo "2 - Run 'make postconf' as root to update /etc/hosts and set UNIX rights"
2007-04-15 19:26:34 +02:00
@echo
2008-10-03 18:12:36 +02:00
@echo " 3 - Use the manager at http://manager. ${ DNSDOMAIN } / (after Apache restart) or edit ${ DESTFILECONFDIR } lmConf-1 to modify LemonLDAP::NG configuration. "
@echo " Edit ${ DESTPORTALDIR } apps/apps-list.xml to modify the menu. "
2007-04-15 19:26:34 +02:00
@echo
@echo "4 - Restart Apache (or Apache2)"
@echo
2008-10-03 18:12:36 +02:00
@echo " 5 - Try to connect to http://test1. ${ DNSDOMAIN } / or http://test2. ${ DNSDOMAIN } / "
postconf_hosts :
@cat ${ SYSTEMCONFDIR } for_etc_hosts >> /etc/hosts
@echo "/etc/hosts was updated"
postconf_unixrights :
@chmod 1777 ${ DESTFILECONFDIR }
@chmod 1777 ${ DESTSESSIONDIR }
@echo "UNIX files permissions set"
postconf : postconf_hosts postconf_unixrights
@echo "Post configuration done"
production_preconf :
2008-10-14 17:50:37 +02:00
# TODO: modify EXAMPLEROOT and set it to /
2008-10-03 18:12:36 +02:00
# TODO: ask parameters value (like DNSDOMAIN, LDAPHOST, etc.)
production_install : production_preconf example
2007-04-15 19:26:34 +02:00
uninstall : configure handler_uninstall portal_uninstall manager_uninstall
2008-11-17 17:59:56 +01:00
common_uninstall : common
@$( MAKE) -C ${ SRCCOMMONDIR } uninstall
@rm -vf common_uninstall
2007-04-15 19:26:34 +02:00
handler_uninstall : handler
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR } uninstall
2008-10-13 22:52:43 +02:00
@rm -vf handler_uninstall
2007-04-15 19:26:34 +02:00
portal_uninstall : portal
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR } uninstall
2008-10-13 22:52:43 +02:00
@rm -vf portal_uninstall
2007-04-15 19:26:34 +02:00
manager_uninstall : manager
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR } uninstall
2008-10-13 22:52:43 +02:00
@rm -vf manager_uninstall
2007-04-15 19:26:34 +02:00
2007-07-27 10:20:49 +02:00
dist : clean
2008-10-03 18:12:36 +02:00
@- $( MAKE) clean
@mkdir -p lemonldap-ng-$( VERSION)
2008-11-17 17:59:56 +01:00
@- cp -pR lemonldap-ng-common/ lemonldap-ng-manager/ lemonldap-ng-portal/ lemonldap-ng-handler/ * lemonldap-ng-$( VERSION)
2008-10-03 18:12:36 +02:00
@- dir = lemonldap-ng-$( VERSION) ; find $$ dir -name .svn -exec rm -rf { } \; 2>/dev/null
@rm -rf lemonldap-ng-$( VERSION) /lemonldap-ng-$( VERSION)
@tar czf lemonldap-ng-$( VERSION) .tar.gz lemonldap-ng-$( VERSION)
@rm -rf lemonldap-ng-$( VERSION)
2007-04-15 19:26:34 +02:00
2008-05-06 10:52:27 +02:00
debian-dist : dist
2008-10-03 18:12:36 +02:00
@mv lemonldap-ng-$( VERSION) .tar.gz lemonldap-ng_$( VERSION) .orig.tar.gz
2008-05-06 10:52:27 +02:00
2008-11-17 17:59:56 +01:00
cpan : clean configure common_cpan handler_cpan portal_cpan manager_cpan
common_cpan : common_conf
@$( MAKE) -C ${ SRCCOMMONDIR } dist
@mv ${ SRCCOMMONDIR } /Lemonldap*.gz .
2007-04-15 19:26:34 +02:00
handler_cpan : handler_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCHANDLERDIR } dist
@mv ${ SRCHANDLERDIR } /Lemonldap*.gz .
2007-04-15 19:26:34 +02:00
portal_cpan : portal_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCPORTALDIR } dist
@mv ${ SRCPORTALDIR } /Lemonldap*.gz .
2007-04-15 19:26:34 +02:00
manager_cpan : manager_conf
2008-10-03 18:12:36 +02:00
@$( MAKE) -C ${ SRCMANAGERDIR } dist
@mv ${ SRCMANAGERDIR } /Lemonldap*.gz .
2007-04-15 19:26:34 +02:00
static_example : example
2008-10-03 18:12:36 +02:00
@mkdir -p ${ SCRIPTSDIR } static/
@cd ${ SCRIPTSDIR } static/; cp -a ../manager/{ imgs,theme} .; cd -
@../scripts/make_static_example.pl ${ DESTMANAGERDIR } index.pl ${ SCRIPTSDIR } static/index.html $( EXAMPLELANG)
2007-04-15 19:26:34 +02:00
2007-05-11 09:52:19 +02:00
documentation :
2008-10-03 18:12:36 +02:00
@cd doc/ && ../scripts/doc.pl
2007-05-11 09:52:19 +02:00