Makefile

---恢复内容开始---

Makefile:

ifeq ($(SYSTYPE),AIX)
include Makefile.aix5
else
ifeq ($(SYSTYPE),HP-UX)
include Makefile.hpux11
else
ifeq ($(SYSTYPE),Linux)
include Makefile.linux
else
ifeq ($(SYSTYPE),SunOS)
include Makefile.gcc_solaris
endif
endif
endif
endif

Makefile.aix5.g++:
############################################################################
##
## Makefile.aix5
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -D_XPG4_EXTENDED -D__unix -D_AIX -DHEADER_DES_LOCL_H #-D_DEBUG #-Wall
TEMPOPTS = -I.

USEROPTS = -g -fPIC
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(COPTIONS) $(CINCDIRS) -g
SHARED = -G

#
# Compilation rules
#
CC = g++ -maix64
LD = g++ -maix64

include common.mk

Makefile.aix5.xlc:
############################################################################
##
## Makefile.aix5
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -D_XPG4_EXTENDED -D__unix -D_AIX -DHEADER_DES_LOCL_H #-D_DEBUG #-Wall
TEMPOPTS = -I.

USEROPTS = -q64 -g -fPIC
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(COPTIONS) $(CINCDIRS) -q64 -g
SHARED = -G

#
# Compilation rules
#
CC = cc
LD = cc

include common.mk

bash-4.2$ cat Makefile.hpux11
############################################################################
##
## Makefile.hpux11
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -D_XPG4_EXTENDED -D__unix -DHEADER_DES_LOCL_H # -D_DEBUG
USEROPTS = -g -DRWSTD_MULTI_THREAD -D_REENTRANT
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(CFLAGS)
SHARED = -b +z
SYSLIBS = -lpthread

CC = aCC
LD = ld

include common.mk

bash-4.2$ cat Makefile.linux
############################################################################
##
## Makefile.linux
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -D_XPG4_EXTENDED -Wall # -DHEADER_DES_LOCL_H # -D_DEBUG
TEMPOPTS = -I.

ifndef USEROPTS
USEROPTS = -g
endif

CFLAGS += $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS += $(CFLAGS) -Wl,-soname -Wl,$(LIBSNMPPLUS_SHARED_SHORT).$(SOVERSION_MAIN)
SHARED = -fPIC -shared

#
# Compilation rules
#
CC = g++
LD = ld

include common.mk

bash-4.2$ cat Makefile.solaris
############################################################################
##
## Makefile.solaris
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -mt -D_XPG4_EXTENDED -D__unix -D_NO_SNMPv3 # -D_DEBUG
USEROPTS = -g -pta
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(CFLAGS)
SHARED = -G -PIC -KPIC
SYSLIBS = -lnsl -lsocket -lresolv -lintl

CC = CC
LD = ld

include common.mk

bash-4.2$ cat common.mk
############################################################################
##
## common.mk
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

# Versions for shared library
SOVERSION = 1.0.0
SOVERSION_MAIN = 1

LIBDESDIR = ../libdes
LIBTOMCRYPTDIR = ../../crypt

PP_INC = ../include

CINCDIRS = -I$(PP_INC) -I./ -I$(LIBDESDIR) -I$(LIBTOMCRYPTDIR)/src/headers

# snmp++ lib headers
HEADERS = $(wildcard $(PP_INC)/snmp_pp/*.h)

# snmp++ lib sources
PP_SRCS = $(wildcard *.cpp)

#
# Object Files produced
#
OBJS = $(PP_SRCS:.cpp=.o)
OBJS_SHARED = $(PP_SRCS:.cpp=_sh.o)

#
# Libraries: dependencies and produced
#
LIBPATH = ../lib
LIBSNMPPLUS_SHARED_SHORT = libsnmp++.so
LIBSNMPPLUS_SHARED = $(LIBPATH)/$(LIBSNMPPLUS_SHARED_SHORT).$(SOVERSION)
LIBSNMPPLUS_SHARED_MAIN = $(LIBPATH)/$(LIBSNMPPLUS_SHARED_SHORT).$(SOVERSION_MAIN)
LIBSNMPPLUS_SHARED_NOVERSION = $(LIBPATH)/$(LIBSNMPPLUS_SHARED_SHORT)

LIBSNMPPLUS = $(LIBPATH)/libsnmp++.a

#
# Installation directories
#
ifndef INSTPREFIX
INSTPREFIX = /usr/local
endif

ifndef INSTLIBPATH
INSTLIBPATH = $(INSTPREFIX)/lib
endif

ifndef INSTINCPATH
INSTINCPATH = $(INSTPREFIX)/include
endif

#
# Here for a quick sanity check upon completing a build...
#

.SUFFIXES: .cpp .C

%.o: %.cpp
$(CC) $(CFLAGS) -o $@ -c $<

%_sh.o: %.cpp
$(CC) $(SHARED) $(CFLAGS) -o $@ -c $<

#
# Build rules
#
all: $(LIBPATH) $(LIBSNMPPLUS) $(LIBSNMPPLUS_SHARED)

lib: $(LIBPATH) $(LIBSNMPPLUS)

shlib: $(LIBPATH) $(LIBSNMPPLUS_SHARED)

$(LIBPATH):
mkdir $(LIBPATH)

$(LIBSNMPPLUS): $(OBJS)
ar -rv $(LIBSNMPPLUS) $(OBJS)

$(LIBSNMPPLUS_SHARED): $(OBJS_SHARED)
$(CC) $(SHARED) $(LDFLAGS) $(OBJS_SHARED) -o $@
rm -f $(LIBSNMPPLUS_SHARED_MAIN) $(LIBSNMPPLUS_SHARED_NOVERSION)
ln -s $(LIBSNMPPLUS_SHARED) $(LIBSNMPPLUS_SHARED_NOVERSION)
ln -s $(LIBSNMPPLUS_SHARED) $(LIBSNMPPLUS_SHARED_MAIN)

clean:
-rm -f core *.o *.rpo *~ a.out ../include/snmp_pp/*~

clobber: clean
-rm -f $(LIBSNMPPLUS) $(LIBSNMPPLUS_SHARED)
-rm -f $(LIBSNMPPLUS_SHARED_MAIN) $(LIBSNMPPLUS_SHARED_NOVERSION)

install: all
install -d $(DESTDIR)$(INSTLIBPATH)
install -d $(DESTDIR)$(INSTINCPATH)/snmp_pp/
install $(LIBSNMPPLUS) $(DESTDIR)$(INSTLIBPATH)
ifneq ($(wildcard $(LIBSNMPPLUS_SHARED)),)
install $(LIBSNMPPLUS_SHARED) $(DESTDIR)$(INSTLIBPATH)
endif
install $(HEADERS) $(DESTDIR)$(INSTINCPATH)/snmp_pp/

#
# Dependency rules
#
$(OBJS): $(HEADERS)

#dependencies: $(PP_SRCS) $(HEADERS)
# $(CC) -MM $(PP_SRCS) $(CINCDIRS) > dependencies
#
#ifneq ($(wildcard dependencies),)
#include dependencies
#endif

---恢复内容结束---

Makefile:

ifeq ($(SYSTYPE),AIX)
include Makefile.aix5
else
ifeq ($(SYSTYPE),HP-UX)
include Makefile.hpux11
else
ifeq ($(SYSTYPE),Linux)
include Makefile.linux
else
ifeq ($(SYSTYPE),SunOS)
include Makefile.gcc_solaris
endif
endif
endif
endif

Makefile.aix5.g++:
############################################################################
##
## Makefile.aix5
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -D_XPG4_EXTENDED -D__unix -D_AIX -DHEADER_DES_LOCL_H #-D_DEBUG #-Wall
TEMPOPTS = -I.

USEROPTS = -g -fPIC
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(COPTIONS) $(CINCDIRS) -g
SHARED = -G

#
# Compilation rules
#
CC = g++ -maix64
LD = g++ -maix64

include common.mk

Makefile.aix5.xlc:
############################################################################
##
## Makefile.aix5
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -D_XPG4_EXTENDED -D__unix -D_AIX -DHEADER_DES_LOCL_H #-D_DEBUG #-Wall
TEMPOPTS = -I.

USEROPTS = -q64 -g -fPIC
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(COPTIONS) $(CINCDIRS) -q64 -g
SHARED = -G

#
# Compilation rules
#
CC = cc
LD = cc

include common.mk

bash-4.2$ cat Makefile.hpux11
############################################################################
##
## Makefile.hpux11
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -D_XPG4_EXTENDED -D__unix -DHEADER_DES_LOCL_H # -D_DEBUG
USEROPTS = -g -DRWSTD_MULTI_THREAD -D_REENTRANT
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(CFLAGS)
SHARED = -b +z
SYSLIBS = -lpthread

CC = aCC
LD = ld

include common.mk

bash-4.2$ cat Makefile.linux
############################################################################
##
## Makefile.linux
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -D_XPG4_EXTENDED -Wall # -DHEADER_DES_LOCL_H # -D_DEBUG
TEMPOPTS = -I.

ifndef USEROPTS
USEROPTS = -g
endif

CFLAGS += $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS += $(CFLAGS) -Wl,-soname -Wl,$(LIBSNMPPLUS_SHARED_SHORT).$(SOVERSION_MAIN)
SHARED = -fPIC -shared

#
# Compilation rules
#
CC = g++
LD = ld

include common.mk

bash-4.2$ cat Makefile.solaris
############################################################################
##
## Makefile.solaris
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

#
# Flags: compiler options, search paths
#

COPTIONS = -mt -D_XPG4_EXTENDED -D__unix -D_NO_SNMPv3 # -D_DEBUG
USEROPTS = -g -pta
CFLAGS = $(COPTIONS) $(CINCDIRS) $(USEROPTS)
LDFLAGS = $(CFLAGS)
SHARED = -G -PIC -KPIC
SYSLIBS = -lnsl -lsocket -lresolv -lintl

CC = CC
LD = ld

include common.mk

bash-4.2$ cat common.mk
############################################################################
##
## common.mk
##
## SNMP++v3.2.24
## -----------------------------------------------
## Copyright (c) 2001-2009 Jochen Katz, Frank Fock
##
## This software is based on SNMP++2.6 from Hewlett Packard:
##
## Copyright (c) 1996
## Hewlett-Packard Company
##
## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
## Permission to use, copy, modify, distribute andor sell this software
## andor its documentation is hereby granted without fee. User agrees
## to display the above copyright notice and this license notice in all
## copies of the software and any documentation of the software. User
## agrees to assume all liability for the use of the software;
## Hewlett-Packard and Jochen Katz make no representations about the
## suitability of this software for any purpose. It is provided
## "AS-IS" without warranty of any kind, either express or implied. User
## hereby grants a royalty-free license to any and all derivatives based
## upon this software code base.
##
## Stuttgart, Germany, Fri May 29 22:35:14 CEST 2009
##
##########################################################################*

# Versions for shared library
SOVERSION = 1.0.0
SOVERSION_MAIN = 1

LIBDESDIR = ../libdes
LIBTOMCRYPTDIR = ../../crypt

PP_INC = ../include

CINCDIRS = -I$(PP_INC) -I./ -I$(LIBDESDIR) -I$(LIBTOMCRYPTDIR)/src/headers

# snmp++ lib headers
HEADERS = $(wildcard $(PP_INC)/snmp_pp/*.h)

# snmp++ lib sources
PP_SRCS = $(wildcard *.cpp)

#
# Object Files produced
#
OBJS = $(PP_SRCS:.cpp=.o)
OBJS_SHARED = $(PP_SRCS:.cpp=_sh.o)

#
# Libraries: dependencies and produced
#
LIBPATH = ../lib
LIBSNMPPLUS_SHARED_SHORT = libsnmp++.so
LIBSNMPPLUS_SHARED = $(LIBPATH)/$(LIBSNMPPLUS_SHARED_SHORT).$(SOVERSION)
LIBSNMPPLUS_SHARED_MAIN = $(LIBPATH)/$(LIBSNMPPLUS_SHARED_SHORT).$(SOVERSION_MAIN)
LIBSNMPPLUS_SHARED_NOVERSION = $(LIBPATH)/$(LIBSNMPPLUS_SHARED_SHORT)

LIBSNMPPLUS = $(LIBPATH)/libsnmp++.a

#
# Installation directories
#
ifndef INSTPREFIX
INSTPREFIX = /usr/local
endif

ifndef INSTLIBPATH
INSTLIBPATH = $(INSTPREFIX)/lib
endif

ifndef INSTINCPATH
INSTINCPATH = $(INSTPREFIX)/include
endif

#
# Here for a quick sanity check upon completing a build...
#

.SUFFIXES: .cpp .C

%.o: %.cpp
$(CC) $(CFLAGS) -o $@ -c $<

%_sh.o: %.cpp
$(CC) $(SHARED) $(CFLAGS) -o $@ -c $<

#
# Build rules
#
all: $(LIBPATH) $(LIBSNMPPLUS) $(LIBSNMPPLUS_SHARED)

lib: $(LIBPATH) $(LIBSNMPPLUS)

shlib: $(LIBPATH) $(LIBSNMPPLUS_SHARED)

$(LIBPATH):
mkdir $(LIBPATH)

$(LIBSNMPPLUS): $(OBJS)
ar -rv $(LIBSNMPPLUS) $(OBJS)

$(LIBSNMPPLUS_SHARED): $(OBJS_SHARED)
$(CC) $(SHARED) $(LDFLAGS) $(OBJS_SHARED) -o $@
rm -f $(LIBSNMPPLUS_SHARED_MAIN) $(LIBSNMPPLUS_SHARED_NOVERSION)
ln -s $(LIBSNMPPLUS_SHARED) $(LIBSNMPPLUS_SHARED_NOVERSION)
ln -s $(LIBSNMPPLUS_SHARED) $(LIBSNMPPLUS_SHARED_MAIN)

clean:
-rm -f core *.o *.rpo *~ a.out ../include/snmp_pp/*~

clobber: clean
-rm -f $(LIBSNMPPLUS) $(LIBSNMPPLUS_SHARED)
-rm -f $(LIBSNMPPLUS_SHARED_MAIN) $(LIBSNMPPLUS_SHARED_NOVERSION)

install: all
install -d $(DESTDIR)$(INSTLIBPATH)
install -d $(DESTDIR)$(INSTINCPATH)/snmp_pp/
install $(LIBSNMPPLUS) $(DESTDIR)$(INSTLIBPATH)
ifneq ($(wildcard $(LIBSNMPPLUS_SHARED)),)
install $(LIBSNMPPLUS_SHARED) $(DESTDIR)$(INSTLIBPATH)
endif
install $(HEADERS) $(DESTDIR)$(INSTINCPATH)/snmp_pp/

#
# Dependency rules
#
$(OBJS): $(HEADERS)

#dependencies: $(PP_SRCS) $(HEADERS)
# $(CC) -MM $(PP_SRCS) $(CINCDIRS) > dependencies
#
#ifneq ($(wildcard dependencies),)
#include dependencies
#endif

详细编写参考:snmp++的makefile编写

原文地址:https://www.cnblogs.com/wcc331902579/p/5920380.html