openbsd-ports/mail/c-client/patches/patch-src_osdep_unix_Makefile
2000-11-11 16:32:45 +00:00

90 lines
2.3 KiB
Plaintext

--- src/osdep/unix/Makefile.orig Tue Oct 24 19:59:24 2000
+++ src/osdep/unix/Makefile Wed Nov 1 18:55:57 2000
@@ -84,6 +84,7 @@
DEFAULTAUTHENTICATORS=md5 $(SPECIALAUTHENTICATORS) log
DEFAULTDRIVERS=imap nntp pop3 mh mx mbx tenex mtx mmdf unix news phile
+.SUFFIXES: .o .so
# Normally no need to change any of these
@@ -92,6 +93,7 @@
dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
unix.o mbox.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o
+SOBINARIES=$(BINARIES:.o=.so)
CFLAGS=$(BASECFLAGS) $(EXTRACFLAGS)
CAT=cat
@@ -100,6 +102,7 @@
RM=rm -rf
SH=sh
+PICFLAG= -fpic
# Primary build command
@@ -211,7 +214,7 @@
SPOOLDIR=/var \
ACTIVEFILE=/usr/local/news/lib/active \
RSHPATH=/usr/bin/rsh \
- BASECFLAGS="-O2 -pipe"
+ BASECFLAGS="-pipe"
cvx: # Convex
$(BUILD) `$(CAT) SPECIALS` OS=$@ \
@@ -707,19 +710,26 @@
# Build it!
+.if defined(NO_SHARED_LIBS) && ${NO_SHARED_LIBS:L} == "yes"
build: clean once $(ARCHIVE)
-
all: $(ARCHIVE)
+.else
+build: clean once $(ARCHIVE) $(SHLIB)
+all: $(ARCHIVE) $(SHLIB)
+.endif
$(ARCHIVE): $(BINARIES)
sh -c '$(RM) $(ARCHIVE) || true'
@$(CAT) ARCHIVE
@$(SH) ARCHIVE
+$(SHLIB): $(SOBINARIES)
+ $(CC) -shared $(PICFLAG) -o $(SHLIB) $(SOBINARIES)
+
# Cleanup
clean:
- sh -c '$(RM) auths.c crexcl.c flockbsd.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE *FLAGS *TYPE $(ARCHIVE) || true'
+ sh -c '$(RM) auths.c crexcl.c flockbsd.c linkage.[ch] siglocal.c osdep*.[ch] *.o *.so ARCHIVE *FLAGS *TYPE $(ARCHIVE) $(SHLIB) || true'
# Dependencies
@@ -753,7 +763,7 @@
# OS-dependent
-osdep.o:mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \
+OSDEPS= mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \
osdep.h env_unix.h tcp_unix.h \
osdep.c env_unix.c fs_unix.c ftl_unix.c nl_unix.c tcp_unix.c \
auths.c crexcl.c flock.c flockbsd.c flcksafe.c fsync.c gethstid.c \
@@ -765,7 +775,15 @@
write.c \
strerror.c strpbrk.c strstr.c strtok.c strtoul.c \
OSCFLAGS
+
+osdep.o: $(OSDEPS)
$(CC) $(CFLAGS) `$(CAT) OSCFLAGS` -c osdep.c
+
+osdep.so: $(OSDEPS)
+ $(CC) $(CFLAGS) `$(CAT) OSCFLAGS` $(PICFLAG) -DPIC -c osdep.c -o $@
+
+.c.so: osdep.h
+ $(CC) $(CFLAGS) $(PICFLAG) -DPIC -c $(@:.so=.c) -o $@
osdep.c: osdepbas.c osdepckp.c osdeplog.c
$(CAT) osdepbas.c osdepckp.c osdeplog.c > osdep.c