1 2 3 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 44 45 46 47 48 49 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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
#
# This makefile simply redirects all targets to "src" directory, but also includes
# some specific package-wide rules.
#
# http://mad-scientist.net/make/rules.html
include Makefile.inc
SHELL=/bin/bash
# These targets are used to invoke make recursively but do some additional actions if necessary:
SPECIAL_PHONY_TARGETS := $(addsuffix .subdir,$(PHONY_TARGETS))
.PHONY: proper tarball dist package_deb package_rpm $(SPECIAL_PHONY_TARGETS)
$(SPECIAL_PHONY_TARGETS): %.subdir:
$(MAKE) -C src $*
$(MAKE) -C dict $*
$(MAKE) -C doc $*
all: all.subdir
install: install.subdir
$(INSTALL_DIR) $(DESTDIR)$(docdir)
$(INSTALL_DATA) README $(DESTDIR)$(docdir)
uninstall: uninstall.subdir
$(RM) -f $(DESTDIR)$(docdir)/README
# We do not uninstall empty directories
# Should remove all Makefile targets:
clean: clean.subdir
$(RM) -f *.deb *.rpm *.srpm $(NAME)*.tar.bz2
# Cleanup all autogenerated files (e.g. used before creating a distro tarball).
distclean: clean distclean.subdir
$(RM) -rf config.status config.cache config.log autom4te.cache
# Everything what is generated by configure script:
$(RM) -f Makefile Makefile.inc doc/manual.sgml package/linux/osra.pc package/linux/debian/control package/linux/debian/rules package/linux/suse/osra.spec pom.xml
# This rule is responsible for correcting permissions after checkout from VCS.
proper:
chmod 755 configure
# This rule creates a tarball from current directory.
# $(TAR_NAME) should be defined before calling this rule:
tarball: distclean proper
tar -C .. -cj --exclude-vcs $(shell basename `pwd`) -f $(TAR_NAME)
# Create a tarball snapshot from current source directory (usually to be uploaded to FTP server).
dist: TAR_NAME := ../$(NAME_VERSION).tar.bz2
# Generate md5:
dist: tarball
cat $(TAR_NAME) | md5sum > $(TAR_NAME).md5
@echo "Archive $(TAR_NAME) was created."
# Use default value if TMP variable is not defined:
BUILD_DIR := $(shell echo $${TMP:-/tmp}/build-$${RANDOM})/$(NAME_VERSION)
# Create DEB package:
package_deb: TAR_NAME := ../$(NAME)_$(VERSION).orig.tar.bz2
package_deb: clean
mkdir -p $(BUILD_DIR)
cp -a . $(BUILD_DIR)
cp -a package/linux/debian $(BUILD_DIR)
# Debian build requires the original tarball name to correspond to mask "NAME_VERSION.orig.(tar|tar.bz2|tar.gz|lzma)":
TAR_NAME=$(TAR_NAME) $(MAKE) -C $(BUILD_DIR) tarball
# Run dpkg build in isolated environment (preserve the exit code):
pushd $(BUILD_DIR); \
debuild -e JAVA_HOME -sa -us -uc; \
exit_code=$$?; \
popd; \
exit $$exit_code;
cp $(BUILD_DIR)/../*.deb $(BUILD_DIR)/$(TAR_NAME) .
$(RM) -rf $(BUILD_DIR)
# Create RPM package:
package_rpm: clean
mkdir -p $(BUILD_DIR)/{SOURCES,SPECS,BUILD,RPMS,SRPMS,$(NAME_VERSION)}
echo "%_topdir $(BUILD_DIR)" > ~/.rpmmacros
cp -a . $(BUILD_DIR)/$(NAME_VERSION)
cp package/linux/suse/osra.spec $(BUILD_DIR)/SPECS
# If you change the tarname here, change also "Source0" in package/linux/suse/osra.spec:
TAR_NAME=$(BUILD_DIR)/SOURCES/$(NAME_VERSION).tar.bz2 $(MAKE) -C $(BUILD_DIR)/$(NAME_VERSION) tarball
# Run RPM build in isolated environment (preserve the exit code):
pushd $(BUILD_DIR)/SPECS; \
rpmbuild -ba --target=$(TARGET_CPU) osra.spec; \
exit_code=$$?; \
popd; \
exit $$exit_code;
$(RM) -f ~/.rpmmacros
# The RPM location depends on target platform and concrete path is unknown in advance:
find $(BUILD_DIR)/RPMS -iname '$(NAME)*.rpm' -exec cp '{}' . \;
# Rename to .srpm, because otherwise *.rpm mask does not match unique file:
cp $(BUILD_DIR)/SRPMS/$(NAME)*.src.rpm $(NAME_VERSION).srpm
$(RM) -rf $(BUILD_DIR)
MVN_COMMON_OPTS := $(MVN_EXTRA_OPTS) -B deploy:deploy-file -Durl=$(REPOSITORY_URL) -DrepositoryId=$(REPOSITORY_ID) -DgroupId=net.sf.osra -Dversion=$(VERSION)
# Maven repository deployment rules for DEB packages:
deploy_deb:
mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME)_*.deb` -DartifactId=$(NAME) -Dclassifier=$(TARGET_CPU) -Dpackaging=deb
mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME)-common_*.deb` -DartifactId=$(NAME)-common -Dclassifier=all -Dpackaging=deb
mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME)_*.tar.bz2` -DartifactId=$(NAME) -Dclassifier=sources -Dpackaging=tar.bz2
-[ -f lib$(NAME)$(LIB_MAJOR_VERSION)_*.deb ] && mvn $(MVN_COMMON_OPTS) -Dfile=`echo lib$(NAME)$(LIB_MAJOR_VERSION)_*.deb` -DartifactId=$(NAME)-lib -Dclassifier=$(TARGET_CPU) -Dpackaging=deb
-[ -f lib$(NAME)-java$(LIB_MAJOR_VERSION)_*.deb ] && mvn $(MVN_COMMON_OPTS) -Dfile=`echo lib$(NAME)-java$(LIB_MAJOR_VERSION)_*.deb` -DartifactId=$(NAME)-lib-java -Dclassifier=$(TARGET_CPU) -Dpackaging=deb
-[ -f lib$(NAME)-dev_*.deb ] && mvn $(MVN_COMMON_OPTS) -Dfile=`echo lib$(NAME)-dev_*.deb` -DartifactId=$(NAME)-devel -Dclassifier=$(TARGET_CPU) -Dpackaging=deb
# Maven repository deployment rules for RPM packages:
deploy_rpm:
mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME_VERSION)-*.rpm` -DartifactId=$(NAME) -Dclassifier=$(TARGET_CPU) -Dpackaging=rpm
mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME)-common-*.rpm` -DartifactId=$(NAME)-common -Dclassifier=noarch -Dpackaging=rpm
mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME)-*.srpm` -DartifactId=$(NAME) -Dclassifier=sources -Dpackaging=srpm
-[ -f $(NAME)-lib$(LIB_MAJOR_VERSION)-*.rpm ] && mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME)-lib$(LIB_MAJOR_VERSION)-*.rpm` -DartifactId=$(NAME)-lib -Dclassifier=$(TARGET_CPU) -Dpackaging=rpm
-[ -f $(NAME)-lib-java$(LIB_MAJOR_VERSION)-*.rpm ] && mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME)-lib-java$(LIB_MAJOR_VERSION)-*.rpm` -DartifactId=$(NAME)-lib-java -Dclassifier=$(TARGET_CPU) -Dpackaging=rpm
-[ -f $(NAME)-devel-*.rpm ] && mvn $(MVN_COMMON_OPTS) -Dfile=`echo $(NAME)-devel-*.rpm` -DartifactId=$(NAME)-devel -Dclassifier=$(TARGET_CPU) -Dpackaging=rpm
# Maven repository deployment rules for JAR package:
deploy_jar:
mvn -B -DaltDeploymentRepository=$(REPOSITORY_ID)::default::$(REPOSITORY_URL) source:jar deploy
beautify:
astyle --style=gnu --suffix=none --recursive "*.cpp" "*.h"
Makefile.inc: Makefile.inc.in config.status
./config.status
config.status: configure
@echo "Your Makefile.inc is older than configure script. As this file is generated by configure, it is strongly advised to re-run configure to update it."
# ./configure
configure: configure.ac aclocal.m4
@echo "Your configure script is older than configure.ac. It is strongly advised to re-run autoconf to update it."
# autoconf
|