Debian Codegraph @

dist/Makefile

raw
1 # ======================================================================
2 # $Source$
3 # $Revision$
4 # $Date$
5 # $Author$
6 # $Name$
7 # $State$
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. Set by Version-Munge.pl
22 VERSION = 5.9.5.2
23
24 VERSION_TAG=`echo Ext-$(VERSION) | sed 's/\./-/g;'`
25
26 WITH_PERL=1
27 EMBED_PERL=1
28
29 # Define the RPM architecture, i.e., 'ppc', 'i386', etc.
30 ARCH = `uname -i`
31
32 # Directory structure expected by 'rpm' program
33 RPM_BASE := $(PWD)/rpm
34
35 RPM_TREE := \
36 $(RPM_BASE)/BUILD \
37 $(RPM_BASE)/RPMS \
38 $(RPM_BASE)/SOURCES \
39 $(RPM_BASE)/SPECS \
40 $(RPM_BASE)/SRPMS
41
42 .PHONY: all clean rpm_files binary_rpm source_rpm all_rpm
43
44 all: all_rpm_files
45
46 # Delete all generated files.
47 clean:
48 rm -rf $(RPM_BASE)
49
50 # --------------------------------------------------------------------
51 # Macros and rules for updating net-snmp-x.x.x.tar.gz.
52 # 'rpm' expects a compressed archive (.tar.gz) of the source directory
53 # to exist (in the rpm/SOURCES directory) before it is run.
54 # --------------------------------------------------------------------
55 CVSROOT = :pserver:[email protected]:/cvsroot/net-snmp
56
57 PKG_VER := $(NAME)-$(VERSION)
58
59 GZIP_TAR := $(RPM_BASE)/SOURCES/$(PKG_VER).tar.gz
60
61 gzip_tar: $(GZIP_TAR)
62
63 $(GZIP_TAR):
64 @echo "Creating a compressed archive of the package's source files..."
65 (cd $(RPM_BASE)/SOURCES; \
66 cvs -d$(CVSROOT) login; \
67 cvs -z3 -d$(CVSROOT) export -r$(VERSION_TAG) $(NAME); \
68 mv $(NAME) $(PKG_VER); \
69 tar cf $(PKG_VER).tar $(PKG_VER); \
70 gzip $(PKG_VER).tar)
71 @echo "A compressed archive of the package's source-file tree has been created."
72
73 # --------------------------------------------------------------------
74 # Macros and rules for updating the binary and source RPM package files.
75 # --------------------------------------------------------------------
76 # Redefine '%_topdir' to allow an RPM package file to be built anywhere,
77 # instead of in the /usr/src/redhat directory tree.
78 #
79 # Don't want 'rpmbuild' to strip your executable programs?
80 # Then add this line:
81 # --define='_os_install_post /usr/lib/rpm/brp-compress' \
82 # to the RPM_OPTS macro definition. This will eliminate the
83 # stripping of binaries, but still retain the compression of
84 # manual pages.
85 #
86 ifeq ($(WITH_PERL),0)
87 PERLOPTS = --without perl_modules
88 endif
89 ifeq ($(EMBED_PERL),0)
90 PERLOPTS += --without embedded_perl
91 endif
92
93 RPM_OPTS := \
94 --define='_topdir $(RPM_BASE)' \
95 --define='_includedir /usr/include/net-snmp' \
96 --target $(ARCH) $(PERLOPTS)
97
98 SPEC_FILE := $(NAME).spec
99 RPM_SPEC := $(RPM_BASE)/SPECS/$(SPEC_FILE)
100
101 BINARY_RPM := $(RPM_BASE)/RPMS/$(ARCH)/$(PKG_VER)-$(RELEASE).$(ARCH).rpm
102 SOURCE_RPM := $(RPM_BASE)/SRPMS/$(PKG_VER)-$(RELEASE).src.rpm
103
104 rpm_files: $(GZIP_TAR) all_rpm_files
105 binary_rpm: $(BINARY_RPM)
106 source_rpm: $(SOURCE_RPM)
107 rpm_tree: $(RPM_TREE)
108
109 all_rpm_files: $(RPM_TREE) $(RPM_SPEC)
110 (cd $(RPM_BASE)/SPECS; \
111 rpmbuild -ba $(RPM_OPTS) $(SPEC_FILE))
112
113 $(BINARY_RPM): $(RPM_TREE) $(RPM_SPEC)
114 (cd $(RPM_BASE)/SPECS; \
115 rpmbuild -bb $(RPM_OPTS) $(SPEC_FILE))
116
117 $(SOURCE_RPM): $(RPM_TREE) $(RPM_SPEC)
118 (cd $(RPM_BASE)/SPECS; \
119 rpmbuild -bs $(RPM_OPTS) $(SPEC_FILE))
120
121 $(RPM_SPEC): $(RPM_BASE)/SPECS $(SPEC_FILE)
122 cp $(SPEC_FILE) $@
123
124 $(RPM_TREE):
125 mkdir -p $@
126
127 $(SPEC_FILE):
128 @echo "ERROR: missing '$(SPEC_FILE)' in the current directory"
129 @exit 1
130
131 FORCE:
132
133 # === End of Makefile === #