Browse Source

Standardize makefile for snmp-ext

Changes made:
  - Simplify spec file.
  - Rename install_non_bb target.
  - Change tarball creation process.
  - mibs folder moved into source folder.

Story: 2004043
Task: 27545

Change-Id: I9cc026aa9c2dbe3f4171ee6b0639a2be6653420c
Signed-off-by: Marcela Rosales <marcela.a.rosales.jimenez@intel.com>
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
Erich Cordoba 2 months ago
parent
commit
26563288d1

+ 0
- 1
snmp-ext/centos/build_srpm.data View File

@@ -1,3 +1,2 @@
1 1
 SRC_DIR="sources"
2
-COPY_LIST="mibs/*"
3 2
 TIS_PATCH_VER=1

+ 12
- 23
snmp-ext/centos/snmp-ext.spec View File

@@ -13,9 +13,6 @@ BuildRequires: libuuid-devel
13 13
 Requires: fm-common
14 14
 Requires: net-snmp
15 15
 
16
-Source1: wrsAlarmMib.mib.txt
17
-Source2: wrsEnterpriseReg.mib.txt
18
-
19 16
 %define mib_ver 2.0
20 17
 %define cgcs_sdk_deploy_dir /opt/deploy/cgcs_sdk
21 18
 
@@ -45,28 +42,20 @@ Group: devel
45 42
 %setup
46 43
 
47 44
 %build
48
-VER=%{version}
49
-MAJOR=`echo $VER | awk -F . '{print $1}'`
50
-MINOR=`echo $VER | awk -F . '{print $2}'`
51
-PATCHVER=` echo %{release} | awk -F r '{print $2}' | awk -F . '{print $1}'`
52
-make  MAJOR=$MAJOR MINOR=$MINOR PATCH=$PATCHVER %{?_smp_mflags}
45
+MAJOR=`echo %{version} | awk -F . '{print $1}'`
46
+MINOR=`echo %{version} | awk -F . '{print $2}'`
47
+make MAJOR=$MAJOR MINOR=$MINOR PATCH=%{tis_patch_ver} %{?_smp_mflags}
53 48
 
54 49
 %install
55
-rm -rf $RPM_BUILD_ROOT
56
-VER=%{version}
57
-MAJOR=`echo $VER | awk -F . '{print $1}'`
58
-MINOR=`echo $VER | awk -F . '{print $2}'`
59
-
60
-PATCHVER=` echo %{release} | awk -F r '{print $2}' | awk -F . '{print $1}'`
61
-make DEST_DIR=$RPM_BUILD_ROOT LIB_DIR=%{_libdir} MAJOR=$MAJOR MINOR=$MINOR PATCH=$PATCHVER install_non_bb
62
-
63
-MIBDIR=wrs-snmp-mib-${MAJOR}.%{mib_ver}
64
-mkdir -p $RPM_BUILD_ROOT%{_datadir}/snmp/mibs
65
-install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/snmp/mibs
66
-install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/snmp/mibs
67
-tar -zc --transform=s/^mibs/${MIBDIR}/ -f wrs-snmp-mib-${MAJOR}.%{mib_ver}.tgz -C $RPM_BUILD_ROOT%{_datadir}/snmp mibs
68
-mkdir -p $RPM_BUILD_ROOT%{cgcs_sdk_deploy_dir}
69
-install -m 644 wrs-snmp-mib-${MAJOR}.%{mib_ver}.tgz $RPM_BUILD_ROOT%{cgcs_sdk_deploy_dir}
50
+MAJOR=`echo %{version} | awk -F . '{print $1}'`
51
+MINOR=`echo %{version} | awk -F . '{print $2}'`
52
+make DEST_DIR=%{buildroot} \
53
+     LIB_DIR=%{_libdir} \
54
+     MAJOR=$MAJOR \
55
+     MINOR=$MINOR \
56
+     SDK_DEPLOY_DIR=%{buildroot}%{cgcs_sdk_deploy_dir} \
57
+     MIBVER=%{mib_ver} \
58
+     PATCH=%{tis_patch_ver} install
70 59
 
71 60
 %files
72 61
 %defattr(-,root,root,-)

+ 24
- 2
snmp-ext/sources/Makefile View File

@@ -1,3 +1,17 @@
1
+#
2
+# SPDX-License-Identifier: Apache-2.0
3
+#
4
+
5
+MAJOR ?= 1
6
+MINOR ?= 0
7
+PATCH ?= 0
8
+MIBVER ?= 2.0
9
+
10
+DEST_DIR ?= /
11
+DATA_DIR ?= /usr/share
12
+LIB_DIR ?= /usr/lib64
13
+SDK_DEPLOY_DIR ?= /opt/deploy/cgcs_sdk
14
+
1 15
 SRCS = cgtsActiveAlarms.c cgtsAgentPlugin.c cgtsEventLogs.c
2 16
 
3 17
 OBJS = $(SRCS:.c=.o)
@@ -5,7 +19,10 @@ LDLIBS = -lfmcommon -lnetsnmp -lnetsnmpagent -luuid
5 19
 INCLUDES += -I./
6 20
 CCFLAGS = -fPIC -g -O2 -Wall -Werror -Wformat -Wformat-security
7 21
 LIBCGTSAGENT_SO := libcgtsAgentPlugin.so
22
+MIBDIR = wrs-snmp-mib-$(MAJOR).$(MIBVER)
23
+
8 24
 build: lib
25
+	tar -zc --transform=s/^mibs/$(MIBDIR)/ -f wrs-snmp-mib-$(MAJOR).$(MIBVER).tgz mibs
9 26
 
10 27
 .c.o:
11 28
 	$(CXX) $(CCFLAGS) $(INCLUDES) -c $< -o $@
@@ -16,10 +33,15 @@ lib: $(OBJS)
16 33
 	ln -sf $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(LIBCGTSAGENT_SO)
17 34
 
18 35
 clean:
19
-	@rm -f $(OBJ) *.o *.so.*
36
+	@rm -f $(OBJ) *.o *.so.* *.tgz
20 37
 
21
-install_non_bb:
38
+install:
22 39
 	install -m 755 -d $(DEST_DIR)$(LIB_DIR)
23 40
 	install -m 755 $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)
41
+	install -m 755 -d $(DEST_DIR)$(DATA_DIR)/snmp/mibs
42
+	install -m 644 mibs/wrsAlarmMib.mib.txt $(DEST_DIR)$(DATA_DIR)/snmp/mibs/
43
+	install -m 644 mibs/wrsEnterpriseReg.mib.txt $(DEST_DIR)$(DATA_DIR)/snmp/mibs/
44
+	install -m 755 -d $(SDK_DEPLOY_DIR)
45
+	install -m 644 wrs-snmp-mib-$(MAJOR).$(MIBVER).tgz $(SDK_DEPLOY_DIR)/
24 46
 	ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO).$(MAJOR)
25 47
 	ln -s $(LIBCGTSAGENT_SO).$(MAJOR).$(MINOR).$(PATCH) $(DEST_DIR)$(LIB_DIR)/$(LIBCGTSAGENT_SO)

snmp-ext/mibs/wrsAlarmMib.mib.txt → snmp-ext/sources/mibs/wrsAlarmMib.mib.txt View File


snmp-ext/mibs/wrsEnterpriseReg.mib.txt → snmp-ext/sources/mibs/wrsEnterpriseReg.mib.txt View File


Loading…
Cancel
Save