File: Makefile

package info (click to toggle)
net-snmp 5.1.2-6.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 19,340 kB
  • ctags: 12,062
  • sloc: ansic: 134,798; perl: 10,855; sh: 10,237; makefile: 5,003
file content (132 lines) | stat: -rw-r--r-- 3,761 bytes parent folder | download
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
# ======================================================================
# $Source: /cvsroot/net-snmp/net-snmp/dist/Makefile,v $
# $Revision: 1.5.2.3 $
# $Date: 2004/08/07 08:03:44 $
# $Author: rstory $
# $Name: Ext-5-1-2 $
# $State: Exp $
# ======================================================================

# Makefile for generating rpm package files (.rpm) for net-snmp.

# GNU 'make'-specific features are used in this makefile.
# Other makes may or may not work with it.
# See http://www.gnu.org/manual/make/index.html for details.

SHELL = /bin/sh

# Define the RPM package name
NAME = net-snmp

# Define the default RPM release number.
VERSION = 5.0.8
RELEASE = 1

VERSION_TAG=`echo Ext-$(VERSION) | sed 's/\./-/g;'`

VER=$(VERSION)
REL=$(RELEASE)

WITH_PERL=1

# Define the RPM architecture, i.e., 'noarch', 'i386', 'i686', etc.
ARCH = i386

# Directory structure expected by 'rpm' program
RPM_BASE := $(PWD)/rpm

RPM_TREE := \
    $(RPM_BASE)/BUILD \
    $(RPM_BASE)/RPMS \
    $(RPM_BASE)/SOURCES \
    $(RPM_BASE)/SPECS \
    $(RPM_BASE)/SRPMS

.PHONY:	all clean rpm_files binary_rpm source_rpm all_rpm

all:	all_rpm_files

# Delete all generated files.
clean:
	rm -rf $(RPM_BASE)

# --------------------------------------------------------------------
# Macros and rules for updating net-snmp-x.x.x.tar.gz.
# 'rpm' expects a compressed archive (.tar.gz) of the source directory
# to exist (in the rpm/SOURCES directory) before it is run.
# --------------------------------------------------------------------
CVSROOT = :pserver:anonymous@cvs.net-snmp.sourceforge.net:/cvsroot/net-snmp

PKG_VER := $(NAME)-$(VER)

GZIP_TAR := $(RPM_BASE)/SOURCES/$(PKG_VER).tar.gz

gzip_tar:	$(GZIP_TAR)

$(GZIP_TAR):
	@echo "Creating a compressed archive of the package's source files..."
	(cd $(RPM_BASE)/SOURCES; \
	cvs -d$(CVSROOT) login; \
	cvs -z3 -d$(CVSROOT) export -r$(VERSION_TAG) $(NAME); \
	mv $(NAME) $(PKG_VER); \
	tar cf $(PKG_VER).tar $(PKG_VER); \
	gzip $(PKG_VER).tar)
	@echo "A compressed archive of the package's source-file tree has been created."

# --------------------------------------------------------------------
# Macros and rules for updating the binary and source RPM package files.
# --------------------------------------------------------------------
# Redefine '%_topdir' to allow an RPM package file to be built anywhere,
# instead of in the /usr/src/redhat directory tree.
#
# Don't want 'rpmbuild' to strip your executable programs?
# Then add this line:
#   --define='_os_install_post /usr/lib/rpm/brp-compress' \
# to the RPM_OPTS macro definition.  This will eliminate the 
# stripping of binaries, but still retain the compression of
# manual pages.
#
PERLOPTS=--define='with_perl $(WITH_PERL)'

RPM_OPTS := \
    --define='_topdir $(PWD)/rpm' \
    --define='_includedir /usr/include/net-snmp' \
    --define='version $(VER)' \
    --define='release $(REL)' \
    --target $(ARCH) $(PERLOPTS)

SPEC_FILE  := $(NAME).spec
RPM_SPEC   := $(RPM_BASE)/SPECS/$(SPEC_FILE)

BINARY_RPM := $(RPM_BASE)/RPMS/$(ARCH)/$(PKG_VER)-$(REL).$(ARCH).rpm
SOURCE_RPM := $(RPM_BASE)/SRPMS/$(PKG_VER)-$(REL).src.rpm

rpm_files:	$(GZIP_TAR) all_rpm_files
binary_rpm:	$(BINARY_RPM)
source_rpm:	$(SOURCE_RPM)

all_rpm_files:	$(RPM_TREE) $(RPM_SPEC)
	(cd $(RPM_BASE)/SPECS; \
	rpmbuild -ba $(RPM_OPTS) $(SPEC_FILE))

$(BINARY_RPM):	$(RPM_TREE) $(RPM_SPEC)
	(cd $(RPM_BASE)/SPECS; \
	rpmbuild -bb $(RPM_OPTS) $(SPEC_FILE))

$(SOURCE_RPM):	$(RPM_TREE) $(RPM_SPEC)
	(cd $(RPM_BASE)/SPECS; \
	rpmbuild -bs $(RPM_OPTS) $(SPEC_FILE))

$(RPM_SPEC):	$(RPM_BASE)/SPECS $(SPEC_FILE)
	cp $(SPEC_FILE) $@

$(RPM_TREE):
	mkdir -p $@

$(SPEC_FILE):
	@echo "ERROR: missing '$(SPEC_FILE)' in the current directory"
	@exit 1

FORCE:

# === End of Makefile === #