Update aiccu.conf permissions (from buildscript)
[aiccu.git] / Makefile
blob0e96136680ba75c2452c9e6479d3101b1155f631
1 # /**********************************************************
2 # SixXS - Automatic IPv6 Connectivity Configuration Utility
3 # ***********************************************************
4 # Copyright 2003-2005 SixXS - http://www.sixxs.net
5 # ***********************************************************
6 # Packaging Makefile
7 # ***********************************************************
8 # $Author: jeroen $
9 # $Id: Makefile,v 1.22 2007-01-11 00:29:33 jeroen Exp $
10 # $Date: 2007-01-11 00:29:33 $
11 # **********************************************************/
13 # Note for BSD people: use GNU Make (gmake)
15 PROJECT=aiccu
16 PROJECT_DESC="Automatic IPv6 Connectivity Configuration Utility"
17 PROJECT_VERSION=$(shell grep "AICCU_VER" common/aiccu.h | head -n 1 | awk '{print $$3}' | tr -d \")
19 # Misc bins
20 RM=@rm -f
21 MAKE:=@${MAKE}
22 CP=@echo [Copy]; cp
23 RPMBUILD=@echo [RPMBUILD]; rpmbuild
24 RPMBUILD_SILENCE=>/dev/null 2>/dev/null
26 # Excludes for limited source release
27 EXCLUDES=--exclude "${PROJECT}/windows-*" --exclude "${PROJECT}/common/aiccu_win32.c" --exclude CVS --exclude "${PROJECT}/common/tsp*" --exclude "${PROJECT}/common/teepee*"
28 DEBEXCL=-Iwindows-* -Icommon/aiccu_win32.c -I*CVS* -Icommon/tsp* -Icommon/teepee*
30 # Change this if you want to install into another dirtree
31 # Required for eg the Debian Package builder
32 DESTDIR=
33 export DESTDIR
35 # This may be updated by RPM's for instance
36 CFLAGS=${RPM_OPT_FLAGS}
38 # Destination Paths (relative to DESTDIR)
39 dirsbin=/usr/sbin/
40 dirbin=/usr/bin/
41 diretc=/etc/
42 dirdoc=/usr/share/doc/${PROJECT}/
44 # Make sure the lower makefile also knows these
45 export PROJECT
46 export PROJECT_DESC
47 export PROJECT_VERSION
48 export PROJECT_COPYRIGHT
49 export DESTDIR
50 export RM
51 export MV
52 export CC
53 export CP
54 export MAKE
55 export dirsbin
56 export dirbin
57 export diretc
58 export dirdoc
59 export RPM_OPT_FLAGS
60 export CFLAGS
62 ####################
63 ## Makefile Targets
64 ####################
66 all: Makefile unix-console/
67 @echo "Building : $(PROJECT) - $(PROJECT_DESC)"
68 @echo "Copyright : SixXS"
69 @echo "Version : $(PROJECT_VERSION)"
70 $(MAKE) -C unix-console all
71 @echo "Building done"
73 install: aiccu
74 @echo "Installing into ${DESTDIR}..."
75 @echo "Binaries..."
76 @mkdir -p ${DESTDIR}${dirsbin}
77 $(MAKE) -C unix-console install
78 @mkdir -p ${DESTDIR}${dirdoc}
79 @echo "Configuration..."
80 @mkdir -p ${DESTDIR}${diretc}
81 ifeq ($(shell echo "A${RPM_BUILD_ROOT}"),A)
82 $(shell [ -f ${DESTDIR}${diretc}${PROJECT}.conf ] || cp -R doc/${PROJECT}.conf ${DESTDIR}${diretc}${PROJECT}.conf)
83 @echo "Documentation..."
84 @cp doc/README ${DESTDIR}${dirdoc}
85 @cp doc/LICENSE ${DESTDIR}${dirdoc}
86 @cp doc/HOWTO ${DESTDIR}${dirdoc}
87 @echo "Installing Debian-style init.d"
88 @mkdir -p ${DESTDIR}${diretc}init.d
89 @cp doc/${PROJECT}.init.debian ${DESTDIR}${diretc}init.d/${PROJECT}
90 else
91 @echo "Installing Redhat-style init.d"
92 @mkdir -p ${DESTDIR}${diretc}init.d
93 @cp doc/${PROJECT}.init.rpm ${DESTDIR}${diretc}init.d/${PROJECT}
94 @cp doc/${PROJECT}.conf ${DESTDIR}${diretc}${PROJECT}.conf
95 endif
96 @echo "Installation into ${DESTDIR}/ completed"
98 help:
99 @echo "$(PROJECT) - $(PROJECT_DESC)"
100 @echo
101 @echo "Makefile targets:"
102 @echo "all : Build everything"
103 @echo "help : This little text"
104 @echo "install : Build & Install into ${DESTDIR}/"
105 @echo "clean : Clean the dirs to be pristine in bondage"
106 @echo
107 @echo "Distribution targets:"
108 @echo "dist : Make all distribution targets (except rpm's)"
109 @echo "tar : Make source tarball (tar.gz)"
110 @echo "bz2 : Make source tarball (tar.bz2)"
111 @echo "deb : Make Debian binary package (.deb)"
112 @echo "debsrc : Make Debian source packages"
113 @echo "rpm : Make RPM package (.rpm)"
114 @echo "rpmsrc : Make RPM source packages"
115 @echo
116 @echo "SixXS targets:"
117 @echo "tarfull : Full tar including Windows directories"
118 @echo "bz2full : Full bz2 including Windows directories"
120 aiccu: doc unix-console/
121 $(MAKE) -C unix-console all
123 doc: doc/aiccu.1
125 doc/aiccu.1: doc/aiccu.sgml
126 docbook-to-man doc/aiccu.sgml >doc/aiccu.1
128 clean: debclean rpmclean
129 $(MAKE) -C unix-console clean
130 -${RM} -r windows-gui/Debug
131 -${RM} -r windows-gui/Release
132 -${RM} windows-gui/AICCU.APS
133 -${RM} windows-gui/AICCU.ncb
134 -${RM} -r windows-console/Debug
135 -${RM} -r windows-console/Release
136 -${RM} windows-console/AICCU.APS
137 -${RM} windows-console/AICCU.ncb
139 # Generate Distribution files
140 dist: tar bz2 deb
142 # tar.gz
143 tar: clean
144 -${RM} ../${PROJECT}_${PROJECT_VERSION}.tar.gz
145 tar -zco -C .. ${EXCLUDES} -f ../${PROJECT}_${PROJECT_VERSION}.tar.gz ${PROJECT}
147 # tar.gz (full)
148 tarfull: clean
149 -${RM} ../${PROJECT}_${PROJECT_VERSION}.tar.gz
150 tar -zco -C .. -f ../${PROJECT}_${PROJECT_VERSION}-full.tar.gz ${PROJECT}
152 # tar.bz2
153 bz2: clean
154 -${RM} ../${PROJECT}_${PROJECT_VERSION}.tar.bz2
155 tar -jco -C .. ${EXCLUDES} -f ../${PROJECT}_${PROJECT_VERSION}.tar.bz2 ${PROJECT}
157 # tar.bz2 (full)
158 bz2full: clean
159 -${RM} ../${PROJECT}_${PROJECT_VERSION}.tar.bz2
160 tar -jco -C .. -f ../${PROJECT}_${PROJECT_VERSION}-full.tar.bz2 ${PROJECT}
162 # .deb
163 deb: clean
164 # Copy the changelog
165 ${CP} doc/changelog debian/changelog
166 ${CP} doc/${PROJECT}.init.debian debian/${PROJECT}.init
167 dpkg-buildpackage $(DEBEXCL) -rfakeroot
168 ${MAKE} clean
170 # Cleanup after debian
171 debclean:
172 -${RM} debian/${PROJECT}.init debian/${PROJECT}.conffiles
173 if [ -f build-stamp ]; then debian/rules clean; fi
175 # RPM
176 rpm: clean tar
177 -${RM} /usr/src/redhat/RPMS/i386/${PROJECT}-*.rpm
178 ${RPMBUILD} -tb --define '${PROJECT}_version ${PROJECT_VERSION}' ../${PROJECT}_${PROJECT_VERSION}.tar.gz ${RPMBUILD_SILENCE}
179 @if [ -d /usr/src/redhat/RPMS/i386/ ]; then mv /usr/src/redhat/RPMS/i386/${PROJECT}-*.rpm ../; fi
180 @if [ -d /usr/src/rpm/RPMS/i386/ ]; then mv /usr/src/rpm/RPMS/i386/${PROJECT}-*.rpm ../; fi
181 @echo "Resulting RPM's:"
182 @ls -l ../${PROJECT}-*.rpm
183 ${MAKE} clean
184 @echo "RPMBuild done"
186 rpmsrc: clean tar
187 -${RM} /usr/src/redhat/RPMS/i386/${PROJECT}-*src.rpm
188 ${RPMBUILD} -ts --define '${PROJECT}_version ${PROJECT_VERSION}' ../${PROJECT}_${PROJECT_VERSION}.tar.gz ${RPMBUILD_SILENCE}
189 @if [ -d /usr/src/redhat/RPMS/i386/ ]; then mv /usr/src/redhat/RPMS/i386/${PROJECT}-*.src.rpm ../; fi
190 @if [ -d /usr/src/rpm/RPMS/i386/ ]; then mv /usr/src/rpm/RPMS/i386/${PROJECT}-*.src.rpm ../; fi
191 @echo "Resulting RPM's:"
192 @ls -l ../${PROJECT}-*.rpm
193 ${MAKE} clean
194 @echo "RPMBuild-src done"
196 rpmclean:
197 -${RM} ../${PROJECT}_${PROJECT_VERSION}.tar.gz
199 # Mark targets as phony
200 .PHONY : all install help clean dist tar bz2 deb debclean rpm rpmsrc