Makefile.am 3.44 KB
Newer Older
tlh2000's avatar
tlh2000 committed
1 2
## Process this file with automake to produce Makefile.in

3
COMPILE_DIRS = BCUnit doc Man Share
tlh2000's avatar
tlh2000 committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

if ENABLE_EXAMPLES
EXAMPLE_COMPILE_DIR = Examples
endif 

COMPILE_DIRS += $(EXAMPLE_COMPILE_DIR)

SUBDIRS = ${COMPILE_DIRS}

distdir=${PACKAGE}-${VERSION}-${RELEASE}

WD=`pwd`
RPM_BUILD_ROOT=${WD}/BUILD
RPM_SOURCE_DIR=${WD}/SOURCES
#RPM_DEFINES=--define "_topdir ${WD}" --define "_prefix ${RPM_BUILD_ROOT}" --define "_unpackaged_files_terminate_build 0"
RPM_DEFINES=--define "_topdir ${WD}" --define "_unpackaged_files_terminate_build 0" --define "_prefix /usr/local"
RPMFLAGS=--buildroot ${RPM_BUILD_ROOT}
ZIP=zip
RPM=rpmbuild

PACKAGE_TMPSPEC=./SPECS/@PACKAGE@-@VERSION@-@RELEASE@.spec
SPECFILE=@PACKAGE@".spec"
CHANGELOG="ChangeLog"
SOURCE_GZIP_FILE=@PACKAGE@-@VERSION@-@RELEASE@.tar.gz
SOURCE_ZIP_FILE=@PACKAGE@-@VERSION@-@RELEASE@.zip
SOURCE_TAR_FILE=@PACKAGE@-@VERSION@-@RELEASE@.tar
TAR_EXCLUDES=--exclude '*/BUILD/*' --exclude '*/SOURCES/*' --exclude '*/RPMS/*' --exclude '*/SRPMS/*' \
	--exclude '*/SPECS/*' --exclude '*.tar' --exclude '*.zip' --exclude '*~' --exclude '*.gz' \
	--exclude '*.rpm' --exclude 'autom4te.cache'
ZIP_EXCLUDES=-x "*/BUILD/*" -x "*/SOURCES/*" -x "*/RPMS/*" -x "*/SRPMS/*" -x "*/SPECS/*" \
	-x "*.tar" -x "*.zip" -x "*~" -x "*.gz" -x "*.rpm" -x "autom4te.cache"

RPM_ATHLON=./RPMS/athlon/@PACKAGE@-@VERSION@-@RELEASE@.athlon.rpm
RPM_I386=./RPMS/i386/@PACKAGE@-@VERSION@-@RELEASE@.i386.rpm
RPM_I486=./RPMS/i486/@PACKAGE@-@VERSION@-@RELEASE@.i486.rpm
RPM_I586=./RPMS/i586/@PACKAGE@-@VERSION@-@RELEASE@.i586.rpm
RPM_I686=./RPMS/i686/@PACKAGE@-@VERSION@-@RELEASE@.i686.rpm
RPM_K6=./RPMS/athlon/@PACKAGE@-@VERSION@-@RELEASE@.k6.rpm
RPM_SRC=./SRPMS/@PACKAGE@-@VERSION@-@RELEASE@.src.rpm

44 45
EXTRA_DIST=bcunit.pc.in
EXTRA_REMOVE=BCUnit-Memory-Dump.lst ${SOURCE_TAR_FILE} ${SOURCE_ZIP_FILE} ${SOURCE_GZIP_FILE} \
tlh2000's avatar
tlh2000 committed
46 47 48
	*.rpm *.o *.ncb *.plg *.opt *.clw *.ilk *.exe *.pdb *.lib

pkgconfigdir = $(libdir)/pkgconfig
49
pkgconfig_DATA = bcunit.pc
tlh2000's avatar
tlh2000 committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96

RPMDIRS=BUILD SOURCES RPMS RPMS/i386 SRPMS SPECS

clean-all: clean
	rm -f ${SOURCE_GZIP_FILE} ${SOURCE_ZIP_FILE} ${SOURCE_TAR_FILE} *.rpm
	rm -rf ${RPMDIRS} `find . -name "Temp"` `find . -name "Debug"`
	for file in ${EXTRA_REMOVE}; do rm -f `find . -name "${file}"`; done	

distclean-all: distclean
	rm -f ${SOURCE_GZIP_FILE} ${SOURCE_ZIP_FILE} ${SOURCE_TAR_FILE} *.rpm
	rm -rf ${RPMDIRS}

rpm: rpm-package

zip: clean
	cd .. && \
	rm -f ${SOURCE_ZIP_FILE} && \
	${ZIP} -rT ${SOURCE_ZIP_FILE} @PACKAGE@-@VERSION@-@RELEASE@/* ${ZIP_EXCLUDES} && \
	cp -f ${SOURCE_ZIP_FILE} ./@PACKAGE@-@VERSION@-@RELEASE@/ && \
	cd @PACKAGE@-@VERSION@-@RELEASE@

tarball: clean
	set -x
	cd .. && \
	rm -f ${SOURCE_TAR_FILE} && \
	tar cvf ${SOURCE_TAR_FILE} ${TAR_EXCLUDES} @PACKAGE@-@VERSION@-@RELEASE@/* && \
	cp -f ${SOURCE_TAR_FILE} ./@PACKAGE@-@VERSION@-@RELEASE@/  && \
	rm -f ${SOURCE_TAR_FILE} && \
	cd @PACKAGE@-@VERSION@-@RELEASE@

gzip: clean tarball
	rm -f ${SOURCE_GZIP_FILE} && \
	gzip ${SOURCE_TAR_FILE}

rpm-package: gzip
	rm -rf ${RPMDIRS} && \
	mkdir -p ${RPMDIRS} && \
	cp ${SPECFILE} ${PACKAGE_TMPSPEC} && \
	echo "%changelog" >> ${PACKAGE_TMPSPEC} && \
	cat ${CHANGELOG} >> ${PACKAGE_TMPSPEC} && \
	export RPM_BUILD_ROOT=${RPM_BUILD_ROOT} && \
	cp ${SOURCE_GZIP_FILE} ${RPM_SOURCE_DIR} 
	${RPM} ${RPM_DEFINES} ${RPMFLAGS} -bb ${PACKAGE_TMPSPEC} && \
	( (cp -f ${RPM_ATHLON} .) || (cp -f ${RPM_I386} .) || (cp -f ${RPM_I486} .) \
	  || (cp -f ${RPM_I586} .) || (cp -f ${RPM_I686} .) \
	  || (cp -f ${RPM_K6} .) || (cp -f ${RPM_NOARCH} .) ) && \
	rm -rf ${RPMDIRS}