and added files
[bcm963xx.git] / userapps / opensource / net-snmp / dist / Makefile
1 # ======================================================================
2 # $Source: /cvsroot/net-snmp/net-snmp/dist/Makefile,v $
3 # $Revision: 1.3 $
4 # $Date: 2002/12/12 13:57:56 $
5 # $Author: rstory $
6 # $Name: Ext-5-0-8 $
7 # $State: Exp $
8 # ======================================================================
9
10 # Makefile for generating rpm package files (.rpm) for net-snmp.
11
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.
15
16 SHELL = /bin/sh
17
18 # Define the RPM package name
19 NAME = net-snmp
20
21 # Define the default RPM release number.
22 VERSION = 5.0.6
23 RELEASE = 1
24
25 VERSION_TAG=`echo Ext-$(VERSION) | sed 's/\./-/g;'`
26
27 VER=$(VERSION)
28 REL=$(RELEASE)
29
30 # Define the RPM architecture, i.e., 'noarch', 'i386', 'i686', etc.
31 ARCH = i386
32
33 # Directory structure expected by 'rpm' program
34 RPM_BASE := $(PWD)/rpm
35
36 RPM_TREE := \
37     $(RPM_BASE)/BUILD \
38     $(RPM_BASE)/RPMS \
39     $(RPM_BASE)/SOURCES \
40     $(RPM_BASE)/SPECS \
41     $(RPM_BASE)/SRPMS
42
43 .PHONY: all clean gzip_tar rpm_files binary_rpm source_rpm
44
45 all:    rpm_files
46
47 # Delete all generated files.
48 clean:
49         rm -rf $(RPM_BASE)
50
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
57
58 PKG_VER := $(NAME)-$(VER)
59
60 GZIP_TAR := $(RPM_BASE)/SOURCES/$(PKG_VER).tar.gz
61
62 gzip_tar:       $(GZIP_TAR)
63
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); \
71         gzip $(PKG_VER).tar)
72         @echo "A compressed archive of the package's source-file tree has been created."
73
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.
79 #
80 # Don't want 'rpmbuild' to strip your executable programs?
81 # Then add this line:
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
85 # manual pages.
86 #
87 RPM_OPTS := \
88     --define='_topdir $(PWD)/rpm' \
89     --define='_includedir /usr/include/net-snmp' \
90     --define='version $(VER)' \
91     --define='release $(REL)' \
92     --target $(ARCH)
93
94 SPEC_FILE  := $(NAME).spec
95 RPM_SPEC   := $(RPM_BASE)/SPECS/$(SPEC_FILE)
96
97 BINARY_RPM := $(RPM_BASE)/RPMS/$(ARCH)/$(PKG_VER)-$(REL).$(ARCH).rpm
98 SOURCE_RPM := $(RPM_BASE)/SRPMS/$(PKG_VER)-$(REL).src.rpm
99
100 rpm_files:      $(GZIP_TAR) binary_rpm source_rpm
101 binary_rpm:     $(BINARY_RPM)
102 source_rpm:     $(SOURCE_RPM)
103
104 $(BINARY_RPM):  $(RPM_TREE) $(RPM_SPEC)
105         (cd $(RPM_BASE)/SPECS; \
106         rpmbuild -bb $(RPM_OPTS) $(SPEC_FILE))
107
108 $(SOURCE_RPM):  $(RPM_TREE) $(RPM_SPEC)
109         (cd $(RPM_BASE)/SPECS; \
110         rpmbuild -bs $(RPM_OPTS) $(SPEC_FILE))
111
112 $(RPM_SPEC):    $(RPM_BASE)/SPECS $(SPEC_FILE)
113         cp $(SPEC_FILE) $@
114
115 $(RPM_TREE):
116         mkdir -p $@
117
118 $(SPEC_FILE):
119         @echo "ERROR: missing '$(SPEC_FILE)' in the current directory"
120         @exit 1
121
122 FORCE:
123
124 # === End of Makefile === #