1 # ======================================================================
2 # $Source: /cvsroot/net-snmp/net-snmp/dist/Makefile,v $
4 # $Date: 2002/12/12 13:57:56 $
8 # ======================================================================
10 # Makefile for generating rpm package files (.rpm) for net-snmp.
12 # GNU 'make'-specific features are used in this makefile.
13 # Other makes may or may not work with it.
14 # See http://www.gnu.org/manual/make/index.html for details.
18 # Define the RPM package name
21 # Define the default RPM release number.
25 VERSION_TAG=`echo Ext-$(VERSION) | sed 's/\./-/g;'`
30 # Define the RPM architecture, i.e., 'noarch', 'i386', 'i686', etc.
33 # Directory structure expected by 'rpm' program
34 RPM_BASE := $(PWD)/rpm
43 .PHONY: all clean gzip_tar rpm_files binary_rpm source_rpm
47 # Delete all generated files.
51 # --------------------------------------------------------------------
52 # Macros and rules for updating net-snmp-x.x.x.tar.gz.
53 # 'rpm' expects a compressed archive (.tar.gz) of the source directory
54 # to exist (in the rpm/SOURCES directory) before it is run.
55 # --------------------------------------------------------------------
56 CVSROOT = :pserver:anonymous@cvs.net-snmp.sourceforge.net:/cvsroot/net-snmp
58 PKG_VER := $(NAME)-$(VER)
60 GZIP_TAR := $(RPM_BASE)/SOURCES/$(PKG_VER).tar.gz
64 $(GZIP_TAR): $(RPM_BASE)/SOURCES
65 @echo "Creating a compressed archive of the package's source files..."
66 (cd $(RPM_BASE)/SOURCES; \
67 cvs -d$(CVSROOT) login; \
68 cvs -z3 -d$(CVSROOT) export -r$(VERSION_TAG) $(NAME); \
69 mv $(NAME) $(PKG_VER); \
70 tar cf $(PKG_VER).tar $(PKG_VER); \
72 @echo "A compressed archive of the package's source-file tree has been created."
74 # --------------------------------------------------------------------
75 # Macros and rules for updating the binary and source RPM package files.
76 # --------------------------------------------------------------------
77 # Redefine '%_topdir' to allow an RPM package file to be built anywhere,
78 # instead of in the /usr/src/redhat directory tree.
80 # Don't want 'rpmbuild' to strip your executable programs?
82 # --define='_os_install_post /usr/lib/rpm/brp-compress' \
83 # to the RPM_OPTS macro definition. This will eliminate the
84 # stripping of binaries, but still retain the compression of
88 --define='_topdir $(PWD)/rpm' \
89 --define='_includedir /usr/include/net-snmp' \
90 --define='version $(VER)' \
91 --define='release $(REL)' \
94 SPEC_FILE := $(NAME).spec
95 RPM_SPEC := $(RPM_BASE)/SPECS/$(SPEC_FILE)
97 BINARY_RPM := $(RPM_BASE)/RPMS/$(ARCH)/$(PKG_VER)-$(REL).$(ARCH).rpm
98 SOURCE_RPM := $(RPM_BASE)/SRPMS/$(PKG_VER)-$(REL).src.rpm
100 rpm_files: $(GZIP_TAR) binary_rpm source_rpm
101 binary_rpm: $(BINARY_RPM)
102 source_rpm: $(SOURCE_RPM)
104 $(BINARY_RPM): $(RPM_TREE) $(RPM_SPEC)
105 (cd $(RPM_BASE)/SPECS; \
106 rpmbuild -bb $(RPM_OPTS) $(SPEC_FILE))
108 $(SOURCE_RPM): $(RPM_TREE) $(RPM_SPEC)
109 (cd $(RPM_BASE)/SPECS; \
110 rpmbuild -bs $(RPM_OPTS) $(SPEC_FILE))
112 $(RPM_SPEC): $(RPM_BASE)/SPECS $(SPEC_FILE)
119 @echo "ERROR: missing '$(SPEC_FILE)' in the current directory"
124 # === End of Makefile === #