--- src/osdep/unix/Makefile.orig Thu Feb 1 13:15:58 2001 +++ src/osdep/unix/Makefile Fri Feb 2 09:06:26 2001 @@ -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=-g CAT=cat @@ -100,6 +102,7 @@ RM=rm -rf SH=sh +PICFLAG= -fpic # Primary build command @@ -210,7 +213,7 @@ SPOOLDIR=/var \ ACTIVEFILE=/usr/local/news/lib/active \ RSHPATH=/usr/bin/rsh \ - BASECFLAGS="-O2 -pipe" + BASECFLAGS="-pipe" cvx: # Convex $(BUILD) `$(CAT) SPECIALS` OS=$@ \ @@ -718,23 +721,32 @@ # 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) + .c.o: `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` $*.c +.c.so: + `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` $(PICFLAG) -DPIC $(@:.so=.c) -o $@ # 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 @@ -768,7 +780,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 \ @@ -780,7 +792,12 @@ write.c \ strerror.c strpbrk.c strstr.c strtok.c strtoul.c \ OSCFLAGS - `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` -c osdep.c + +osdep.o: $(OSDEPS) + `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` osdep.c + +osdep.so: $(OSDEPS) + `$(CAT) CCTYPE` -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` $(PICFLAG) -DPIC osdep.c -o $@ osdep.c: osdepbas.c osdepckp.c osdeplog.c $(CAT) osdepbas.c osdepckp.c osdeplog.c > osdep.c