2008-05-05 14:25:28 -05:00
i n c l u d e V E R S I O N
2009-03-04 13:07:27 -06:00
SUBDIRS = daemons install ipapython ipa-client
RADIUSDIRS = ipa-radius-server ipa-radius-admintools
2009-10-12 15:00:00 -05:00
CLIENTDIRS = ipapython ipa-client
0000-12-31 18:09:24 -05:50
0000-12-31 18:09:24 -05:50
PRJ_PREFIX = ipa
0000-12-31 18:09:24 -05:50
2007-08-15 12:09:01 -05:00
RPMBUILD ?= $( PWD) /rpmbuild
2008-04-21 17:23:02 -05:00
TARGET ?= master
2007-08-15 12:09:01 -05:00
2008-05-05 14:25:28 -05:00
# After updating the version in VERSION you should run the version-update
0000-12-31 18:09:24 -05:50
# target.
2008-05-05 14:25:28 -05:00
i f e q ( $( IPA_VERSION_IS_GIT_SNAPSHOT ) , "yes" )
GIT_VERSION = $( shell git show --pretty= format:"%h" --stat HEAD 2>/dev/null| head -1)
i f n e q ( $( GIT_VERSION ) , )
IPA_VERSION = $( IPA_VERSION_MAJOR) .$( IPA_VERSION_MINOR) .$( IPA_VERSION_RELEASE) GIT$( GIT_VERSION)
e n d i f # in a git tree and git returned a version
e n d i f # git
i f n d e f I P A _ V E R S I O N
i f d e f I P A _ V E R S I O N _ P R E _ R E L E A S E
IPA_VERSION = $( IPA_VERSION_MAJOR) .$( IPA_VERSION_MINOR) .$( IPA_VERSION_RELEASE) .pre$( IPA_VERSION_PRE_RELEASE)
e l s e
i f d e f I P A _ V E R S I O N _ R C _ R E L E A S E
IPA_VERSION = $( IPA_VERSION_MAJOR) .$( IPA_VERSION_MINOR) .$( IPA_VERSION_RELEASE) .rc$( IPA_VERSION_RC_RELEASE)
e l s e
IPA_VERSION = $( IPA_VERSION_MAJOR) .$( IPA_VERSION_MINOR) .$( IPA_VERSION_RELEASE)
e n d i f # rc
e n d i f # pre
e n d i f # ipa_version
2009-02-02 12:50:53 -06:00
TARBALL_PREFIX = freeipa-$( IPA_VERSION)
TARBALL = $( TARBALL_PREFIX) .tar.gz
2008-02-08 10:09:06 -06:00
2008-08-08 08:35:05 -05:00
IPA_RPM_RELEASE = $( shell cat RELEASE)
0000-12-31 18:09:24 -05:50
LIBDIR ?= /usr/lib
2009-02-02 12:50:53 -06:00
all : bootstrap -autogen server
0000-12-31 18:09:24 -05:50
@for subdir in $( SUBDIRS) ; do \
( cd $$ subdir && $( MAKE) $@ ) || exit 1; \
done
2009-10-12 15:00:00 -05:00
client : client -autogen
@for subdir in $( CLIENTDIRS) ; do \
( cd $$ subdir && $( MAKE) all) || exit 1; \
done
2009-03-04 13:07:27 -06:00
radius :
@for subdir in $( RADIUSDIRS) ; do \
( cd $$ subdir && $( MAKE) all) || exit 1; \
done
2009-10-12 15:00:00 -05:00
bootstrap-autogen : version -update client -autogen
2008-05-05 14:25:28 -05:00
@echo " Building IPA $( IPA_VERSION) "
2009-02-03 15:56:41 -06:00
cd daemons; if [ ! -e Makefile ] ; then ../autogen.sh --prefix= /usr --sysconfdir= /etc --localstatedir= /var --libdir= $( LIBDIR) ; fi
cd install; if [ ! -e Makefile ] ; then ../autogen.sh --prefix= /usr --sysconfdir= /etc --localstatedir= /var --libdir= $( LIBDIR) ; fi
2009-10-12 15:00:00 -05:00
client-autogen : version -update
2009-09-14 16:04:08 -05:00
cd ipa-client; if [ ! -e Makefile ] ; then ../autogen.sh --prefix= /usr --sysconfdir= /etc --localstatedir= /var --libdir= $( LIBDIR) --with-openldap; fi
2010-03-15 10:40:58 -05:00
cd install; if [ ! -e Makefile ] ; then ../autogen.sh --prefix= /usr --sysconfdir= /etc --localstatedir= /var --libdir= $( LIBDIR) ; fi
0000-12-31 18:09:24 -05:50
2009-02-02 12:50:53 -06:00
install : all server -install
0000-12-31 18:09:24 -05:50
@for subdir in $( SUBDIRS) ; do \
( cd $$ subdir && $( MAKE) $@ ) || exit 1; \
done
2009-10-12 15:00:00 -05:00
client-install : client
@for subdir in $( CLIENTDIRS) ; do \
( cd $$ subdir && $( MAKE) install) || exit 1; \
done
2010-03-15 10:40:58 -05:00
cd install/po && $( MAKE) install || exit 1;
2009-10-12 15:00:00 -05:00
if [ " $( DESTDIR) " = "" ] ; then \
python setup-client.py install; \
else \
python setup-client.py install --root $( DESTDIR) ; \
fi
2009-03-04 13:07:27 -06:00
radius-install : radius install
@for subdir in $( RADIUSDIRS) ; do \
( cd $$ subdir && $( MAKE) install) || exit 1; \
done
2007-09-04 12:22:45 -05:00
test :
2010-04-16 09:58:48 -05:00
$( MAKE) -C install/po test_lang
2009-02-03 14:03:17 -06:00
./make-test
2007-09-04 12:22:45 -05:00
2008-08-08 08:35:05 -05:00
release-update :
if [ ! -e RELEASE ] ; then echo 0 > RELEASE; fi
version-update : release -update
sed -e s/__VERSION__/$( IPA_VERSION) / -e s/__RELEASE__/$( IPA_RPM_RELEASE) / \
2009-02-02 12:50:53 -06:00
ipa.spec.in > ipa.spec
sed -e s/__VERSION__/$( IPA_VERSION) / version.m4.in \
> version.m4
0000-12-31 18:09:24 -05:50
2009-02-05 14:03:08 -06:00
sed -e s/__VERSION__/$( IPA_VERSION) / ipapython/setup.py.in \
> ipapython/setup.py
sed -e s/__VERSION__/$( IPA_VERSION) / ipapython/version.py.in \
> ipapython/version.py
perl -pi -e " s:__NUM_VERSION__: $( IPA_VERSION_MAJOR) $( IPA_VERSION_MINOR) $( IPA_VERSION_RELEASE) : " ipapython/version.py
0000-12-31 18:09:24 -05:50
2008-08-08 08:35:05 -05:00
sed -e s/__VERSION__/$( IPA_VERSION) / -e s/__RELEASE__/$( IPA_RPM_RELEASE) / \
ipa-client/ipa-client.spec.in > ipa-client/ipa-client.spec
sed -e s/__VERSION__/$( IPA_VERSION) / ipa-client/version.m4.in \
> ipa-client/version.m4
2007-08-16 17:00:16 -05:00
2009-02-02 12:50:53 -06:00
server :
python setup.py build
0000-12-31 18:09:24 -05:50
2009-02-02 12:50:53 -06:00
server-install : server
2009-10-12 15:00:00 -05:00
if [ " $( DESTDIR) " = "" ] ; then \
2009-02-02 12:50:53 -06:00
python setup.py install; \
else \
python setup.py install --root $( DESTDIR) ; \
fi
0000-12-31 18:09:24 -05:50
0000-12-31 18:09:24 -05:50
archive :
0000-12-31 18:09:24 -05:50
-mkdir -p dist
2008-04-21 17:23:02 -05:00
git archive --format= tar --prefix= ipa/ $( TARGET) | ( cd dist && tar xf -)
0000-12-31 18:09:24 -05:50
0000-12-31 18:09:24 -05:50
local-archive :
2009-02-02 12:50:53 -06:00
-mkdir -p dist/$( TARBALL_PREFIX)
rsync -a --exclude= dist --exclude= .git --exclude= build --exclude= rpmbuild . dist/$( TARBALL_PREFIX)
0000-12-31 18:09:24 -05:50
archive-cleanup :
2009-02-02 12:50:53 -06:00
rm -fr dist/freeipa
0000-12-31 18:09:24 -05:50
2009-02-02 12:50:53 -06:00
tarballs : local -archive
2008-02-21 09:23:29 -06:00
-mkdir -p dist/sources
2009-02-02 12:50:53 -06:00
# tar up clean sources
2009-09-14 16:04:08 -05:00
cd dist/$( TARBALL_PREFIX) /ipa-client; ../autogen.sh --prefix= /usr --sysconfdir= /etc --localstatedir= /var --libdir= $( LIBDIR) --with-openldap; make distclean
2009-02-03 15:56:41 -06:00
cd dist/$( TARBALL_PREFIX) /daemons; ../autogen.sh --prefix= /usr --sysconfdir= /etc --localstatedir= /var --libdir= $( LIBDIR) ; make distclean
cd dist/$( TARBALL_PREFIX) /install; ../autogen.sh --prefix= /usr --sysconfdir= /etc --localstatedir= /var --libdir= $( LIBDIR) ; make distclean
2009-02-02 12:50:53 -06:00
cd dist; tar cfz sources/$( TARBALL) $( TARBALL_PREFIX)
rm -rf dist/$( TARBALL_PREFIX)
0000-12-31 18:09:24 -05:50
2007-08-15 12:09:01 -05:00
rpmroot :
mkdir -p $( RPMBUILD) /BUILD
mkdir -p $( RPMBUILD) /RPMS
mkdir -p $( RPMBUILD) /SOURCES
mkdir -p $( RPMBUILD) /SPECS
mkdir -p $( RPMBUILD) /SRPMS
2008-02-21 09:23:29 -06:00
rpmdistdir :
mkdir -p dist/rpms
mkdir -p dist/srpms
2009-02-02 12:50:53 -06:00
rpms : rpmroot rpmdistdir version -update tarballs
cp dist/sources/$( TARBALL) $( RPMBUILD) /SOURCES/.
rpmbuild --define " _topdir $( RPMBUILD) " -ba ipa.spec
cp rpmbuild/RPMS/*/$( PRJ_PREFIX) -*-$( IPA_VERSION) -*.rpm dist/rpms/
cp rpmbuild/SRPMS/$( PRJ_PREFIX) -$( IPA_VERSION) -*.src.rpm dist/srpms/
2009-02-04 09:52:14 -06:00
rm -rf rpmbuild
0000-12-31 18:09:24 -05:50
2009-10-12 15:00:00 -05:00
client-rpms : rpmroot rpmdistdir version -update tarballs
cp dist/sources/$( TARBALL) $( RPMBUILD) /SOURCES/.
rpmbuild --define " _topdir $( RPMBUILD) " --define "ONLY_CLIENT 1" -ba ipa.spec
cp rpmbuild/RPMS/*/$( PRJ_PREFIX) -*-$( IPA_VERSION) -*.rpm dist/rpms/
cp rpmbuild/SRPMS/$( PRJ_PREFIX) -$( IPA_VERSION) -*.src.rpm dist/srpms/
rm -rf rpmbuild
2009-05-07 16:37:29 -05:00
srpms : rpmroot rpmdistdir version -update tarballs
cp dist/sources/$( TARBALL) $( RPMBUILD) /SOURCES/.
rpmbuild --define " _topdir $( RPMBUILD) " -bs ipa.spec
cp rpmbuild/SRPMS/$( PRJ_PREFIX) -$( IPA_VERSION) -*.src.rpm dist/srpms/
rm -rf rpmbuild
2008-02-21 09:23:29 -06:00
repodata :
-createrepo -p dist
dist : version -update archive tarballs archive -cleanup rpms repodata
0000-12-31 18:09:24 -05:50
2009-02-03 15:56:41 -06:00
local-dist : bootstrap -autogen clean local -archive tarballs archive -cleanup rpms
0000-12-31 18:09:24 -05:50
2008-08-08 08:35:05 -05:00
clean : version -update
0000-12-31 18:09:24 -05:50
@for subdir in $( SUBDIRS) ; do \
( cd $$ subdir && $( MAKE) $@ ) || exit 1; \
done
rm -f *~
2008-08-08 08:35:05 -05:00
distclean : version -update
2009-10-12 15:00:00 -05:00
touch daemons/NEWS daemons/README daemons/AUTHORS daemons/ChangeLog
touch install/NEWS install/README install/AUTHORS install/ChangeLog
0000-12-31 18:09:24 -05:50
@for subdir in $( SUBDIRS) ; do \
( cd $$ subdir && $( MAKE) $@ ) || exit 1; \
done
2009-02-02 12:50:53 -06:00
rm -fr rpmbuild dist build
2009-10-12 15:00:00 -05:00
rm -f daemons/NEWS daemons/README daemons/AUTHORS daemons/ChangeLog
rm -f install/NEWS install/README install/AUTHORS install/ChangeLog
0000-12-31 18:09:24 -05:50
0000-12-31 18:09:24 -05:50
maintainer-clean : clean
2009-02-02 12:50:53 -06:00
rm -fr rpmbuild dist build
cd selinux && $( MAKE) maintainer-clean
cd daemons && $( MAKE) maintainer-clean
cd install && $( MAKE) maintainer-clean
0000-12-31 18:09:24 -05:50
cd ipa-client && $( MAKE) maintainer-clean
2009-02-05 14:03:08 -06:00
cd ipapython && $( MAKE) maintainer-clean
2008-08-08 08:35:05 -05:00
cd ipa-radius-admintools && $( MAKE) maintainer-clean
cd ipa-radius-server && $( MAKE) maintainer-clean
2009-02-02 12:50:53 -06:00
rm -f version.m4
rm -f ipa.spec