create a shared library for libnet

This commit is contained in:
brad 2001-02-26 02:55:34 +00:00
parent 6806651b94
commit 914a5daa3f
4 changed files with 60 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.20 2001/02/26 02:47:41 brad Exp $
# $OpenBSD: Makefile,v 1.21 2001/02/26 02:55:34 brad Exp $
DISTNAME= libnet-1.0.2a
CATEGORIES= net
@ -19,3 +19,7 @@ CONFIGURE_STYLE= gnu
WRKDIST= ${WRKDIR}/Libnet-1.0.2a
.include <bsd.port.mk>
.if defined(NO_SHARED_LIBS) && ${NO_SHARED_LIBS:L} == "yes"
MAKE_ENV= NO_SHARED_LIBS=Yes
.endif

View File

@ -1,6 +1,6 @@
--- Makefile.in.orig Mon Feb 19 00:50:09 2001
+++ Makefile.in Mon Feb 19 00:52:07 2001
@@ -36,7 +36,7 @@ AR = @AR@
--- Makefile.in.orig Mon Feb 5 12:51:41 2001
+++ Makefile.in Sun Feb 25 05:21:28 2001
@@ -36,7 +36,7 @@
LN = @LN@
CC = @CC@
ENSUREDIR = $(srcdir)/ensure-dir.sh
@ -9,7 +9,50 @@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
OBJECTS = src/libnet_resolve.o\
@@ -98,18 +98,18 @@ install: libnet
@@ -66,17 +66,28 @@
src/libnet_hex_dump.o\
src/libnet_if_addr.o\
src/libnet_port_list.o
+SHOBJECTS= $(OBJECTS:S/.o/.so/)
+
+PICFLAG= -fpic
+SHLIB= $(LIBNET).so.0.0
+
+.SUFFIXES: .o .so
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) -c $< -o $@
-all: libnet
+.c.so:
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFINES) $(PICFLAG) -DPIC -c $< -o $@
+
supp: test example
libnet: version.h $(OBJECTS)
$(AR) -cr $(LIB) $(OBJECTS)
$(RANLIB) $(LIB)
+$(SHLIB): version.h $(SHOBJECTS)
+ $(CC) -shared $(PICFLAG) -o $(SHLIB) $(SHOBJECTS)
+
version.o: version.h
version.h: ./VERSION
@rm -f $@
@@ -91,25 +102,34 @@
example: libnet install
cd example; make
+.if defined(NO_SHARED_LIBS) && ${NO_SHARED_LIBS:L} == "yes"
+all: libnet
install: libnet
+.else
+all: libnet $(SHLIB)
+install: libnet $(SHLIB)
+.endif
$(ENSUREDIR) $(DESTDIR)$(prefix) 755
$(ENSUREDIR) $(DESTDIR)$(LIB_PREFIX) 755
$(ENSUREDIR) $(DESTDIR)$(INC_PREFIX)$(LIBNET) 755
$(ENSUREDIR) $(DESTDIR)$(INC_PREFIX) 755
$(ENSUREDIR) $(DESTDIR)$(MAN_PREFIX) 755
$(ENSUREDIR) $(DESTDIR)$(BIN_PREFIX) 755
@ -26,6 +69,9 @@
- $(INSTALL_DATA) $(INCLUDE-O) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
- $(INSTALL_DATA) $(MAN) $(DESTDIR)$(MAN_PREFIX)
- $(INSTALL_DATA) $(CONFIG) $(DESTDIR)$(BIN_PREFIX)
+ @if [ -f $(SHLIB) ]; then \
+ $(INSTALL_DATA) -m 0644 $(SHLIB) $(DESTDIR)$(LIB_PREFIX) ;\
+ fi
+ $(INSTALL_DATA) -m 0644 $(INCLUDE) $(DESTDIR)$(INC_PREFIX)
+ $(INSTALL_DATA) -m 0644 $(INCLUDE-H) $(DESTDIR)$(INC_PREFIX)$(LIBNET)
+ $(INSTALL_DATA) -m 0644 $(INCLUDE-F) $(DESTDIR)$(INC_PREFIX)$(LIBNET)

View File

@ -0,0 +1,3 @@
@comment $OpenBSD: PFRAG.shared,v 1.1 2001/02/26 02:55:35 brad Exp $
lib/libnet.so.0.0
DYNLIBDIR(%B)

View File

@ -1,6 +1,7 @@
@comment $OpenBSD: PLIST,v 1.6 2000/06/25 00:32:59 brad Exp $
@comment $OpenBSD: PLIST,v 1.7 2001/02/26 02:55:35 brad Exp $
bin/libnet-config
lib/libnet.a
%%SHARED%%
include/libnet.h
include/libnet/libnet-asn1.h
include/libnet/libnet-functions.h