summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-06 17:54:31 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-06 17:54:31 +0800
commit76227669108d6715800d95289b32269d69ba4fbe (patch)
tree72771788b4fe56f2fe35a57c672f488a38799bd6
parent761f24e6af4c4691bcc0bcabba0197c0426d233d (diff)
downloadpttbbs-76227669108d6715800d95289b32269d69ba4fbe.tar
pttbbs-76227669108d6715800d95289b32269d69ba4fbe.tar.gz
pttbbs-76227669108d6715800d95289b32269d69ba4fbe.tar.bz2
pttbbs-76227669108d6715800d95289b32269d69ba4fbe.tar.lz
pttbbs-76227669108d6715800d95289b32269d69ba4fbe.tar.xz
pttbbs-76227669108d6715800d95289b32269d69ba4fbe.tar.zst
pttbbs-76227669108d6715800d95289b32269d69ba4fbe.zip
rewrite Makefile for using pttbbs.mk and clean a lot of
unnecessary part. due to apply '-Wall', making innbbsd will show many and many warning. just ignore it. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2315 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--innbbsd/Makefile251
1 files changed, 52 insertions, 199 deletions
diff --git a/innbbsd/Makefile b/innbbsd/Makefile
index 69208a38..c99f549b 100644
--- a/innbbsd/Makefile
+++ b/innbbsd/Makefile
@@ -1,3 +1,4 @@
+# $Id$
# ------------------------------------------------------- #
# innbbsd/Makefile ( NTHU CS MapleBBS Ver 2.36 ) #
# ------------------------------------------------------- #
@@ -7,215 +8,67 @@
# ------------------------------------------------------- #
# stdarg.h patch for pttbbs by in2 03/05/05 #
-OS!=uname
-OSTYPE?=$(OS)
-####################################################
-# this is a bbs <--> news gateway
-#####################################################
-VERSION=0.51
-LASTVERSION=0.50beta-4
-ADMINUSER?= root@your.domain.name
-BBSHOME?=$(HOME)
-BBS_SRC = ..
-TARGET = $(INNBBSD)
-####################################################
-CC=gcc
-INSTALL=cp
-#
-OPT= -O -s -pipe -fomit-frame-pointer
-
-BBS_DEP = MapleBBS
-BBS_UTIL = $(BBS_SRC)/util
-BBS_REC = $(BBS_UTIL)/util_record.o $(BBS_UTIL)/util_cache.o \
- $(BBS_UTIL)/util_passwd.o $(BBS_UTIL)/util_stuff.o \
- $(BBS_UTIL)/util_var.o $(BBS_UTIL)/util_file.o \
- $(BBS_REC_EXTRA_$(OSTYPE))
-
-BBS_REC_EXTRA_Linux = $(BBS_UTIL)/util_osdep.o
-BBS_REC_EXTRA_Solaris = $(BBS_UTIL)/util_osdep.o
-
-#########################
-#
-###############
-DEBUGOBJ = /usr/lib/debug/mallocmap.o
-CFLAGS+= -c -I. -I$(BBS_SRC)/include -I$(BBS_SRC)/mbbsd -D$(BBS_DEP) \
- -I/usr/local/include -L/usr/local/lib \
- $(EXTRAFLAGS) -DDBZDEBUG -DBBSHOME='"$(BBSHOME)"' \
- -D_PATH_BBSHOME=\"$(BBSHOME)\" \
- -DVERSION=\"$(VERSION)\" -DADMINUSER=\"$(ADMINUSER)\"
-#LDFLAGS+= -L/usr/local/lib
-#
-####################################################
-
-OBJS = inndchannel.o innbbsd.o connectsock.o rfc931.o \
- daemon.o file.o pmain.o his.o dbz.o \
- closeonexec.o dbztool.o inntobbs.o receive_article.o \
- echobbslib.o str_decode.o $(BBS_REC) nocem.o
- # $(BBS_REC)
-SRCS = inndchannel.c innbbsd.c connectsock.c rfc931.c \
- daemon.c file.c pmain.c parsdate.y his.c dbz.c \
- closeonexec.c dbztool.c inntobbs.c bbslib.c receive_article.c \
- port.c str_decode.c nocem.c
-
-MOBJS = makedbz.o bbslib.o file.o dbz.o closeonexec.o
-HOBJS = mkhistory.o bbslib.o file.o his.o dbz.o port.o closeonexec.o \
- $(BBS_REC_EXTRA_$(OSTYPE))
-DBZOBJS = dbzserver.o dbzinnbbsd.o pmain.o connectsock.o bbslib.o his.o \
- daemon.o file.o dbz.o dbztool.o rfc931.o port.o closeonexec.o \
- morelog.o
-NNRPOBJS = bbsnnrp.o pmain.o bbslib.o connectsock.o file.o
-LINKOBJS = bbslink.o pmain.o inntobbs.o echobbslib.o connectsock.o file.o port.o\
- str_decode.o $(BBS_REC_EXTRA_$(OSTYPE))
-LINKOBJS2 = bbslink2.o pmain.o inntobbs.o echobbslib.o connectsock.o file.o port.o
-CTLOBJS = ctlinnbbsd.o pmain.o bbslib.o connectsock.o file.o
-INNBBSD = innbbsd mkhistory bbsnnrp ctlinnbbsd $(BBSLINK)
-BBSNNRP = bbsnnrp
-BBSLINK = bbslink
-BBSLINK2 = bbslink2
-EXES = $(TARGET)
-
-.c.o:
- $(CC) $(OPT) $(CFLAGS) $*.c
-
-
-all: $(OSTYPE)
-
-sun:
- @$(MAKE) EXTRAFLAGS="-DMMAP -DGETRUSAGE -DMALLOCMAP" LDFLAGS="$(DEBUGOBJ)" target
-
-
-aix:
- @$(MAKE) CC=cc EXTRAFLAGS="-DMMAP -DGETRUSAGE -DAIX -DSYSV" target
-
-Linux:
- @$(MAKE) EXTRAFLAGS="-DLINUX -DGETRUSAGE" target
-
-hpux:
- @$(MAKE) OPT= EXTRAFLAGS="-DMMAP -DHPUX -DSYSV" target
-
-irix:
- @$(MAKE) EXTRAFLAGS="-DMMAP -DIRIX -DSYSV" target
-
-Solaris: solaris
-
-solaris:
- @$(MAKE) EXTRAFLAGS="-DMMAP -DSolaris -DSYSV -I/usr/local/include/ -I../include/" LDFLAGS="-L/usr/local/lib -liconv -lsocket -lnsl -lkstat" YACC="bison -y" target
-
-FreeBSD:
- @$(MAKE) CC=cc EXTRAFLAGS="-DBSD44 -DMMAP -DGETRUSAGE" LDFLAGS="-L/usr/local/lib -lcrypt -liconv" target
-
-bsd:
- @$(MAKE) CC=cc EXTRAFLAGS="-DMMAP -DGETRUSAGE" target
-
-alpha:
- @$(MAKE) CC=cc EXTRAFLAGS="-DMMAP -DDEC_ALPHA -DGETRUSAGE" target
-
-sysv:
- @$(MAKE) OPT= EXTRAFLAGS="-DMMAP -DSYSV" target
-
-target: $(EXES)
-
-r_port.o: r_port.c
- $(CC) $(OPT) $(CFLAGS) -DWITH_RECORD_O r_port.c
-
-echobbslib.o: echobbslib.c
- $(CC) $(OPT) $(CFLAGS) -DWITH_ECHOMAIL echobbslib.c
-
-tar:
- test -d innbbsd-$(VERSION) || mkdir innbbsd-$(VERSION)
- cp *.c *.h Makefile innbbsd-$(VERSION)
- tar zcf innbbsd-$(VERSION).tar.gz innbbsd-$(VERSION)
- cp innbbsd-$(VERSION).tar.gz /net/ftphome/CSIE/innbbsd
-
-patch:
- rm -rf /tmp/innbbsd-$(LASTVERSION)
- zcat /net/ftphome/ftp-data/bbs/misc/innbbsd/innbbsd-$(LASTVERSION).tar.gz | (cd /tmp; tar xf -)
- (cd /tmp/innbbsd-$(VERSION); make clean; rm -f r_port.c dbzserver.c dbzinnbbsd.c echobbslib.c )
- (cd /tmp/innbbsd-$(LASTVERSION); make clean; rm -f r_port.c dbzserver.c dbzinnbbsd.c echobbslib.c )
- (cd /tmp; diff -rcs innbbsd-$(LASTVERSION) innbbsd-$(VERSION) > /tmp/innbbsd-patch.$(LASTVERSION)-$(VERSION); echo "diff -rcs")
- (cd /tmp/innbbsd-$(VERSION); ln -s port.c r_port.c)
- (cd /tmp/innbbsd-$(VERSION); ln -s inndchannel.c dbzserver.c)
- (cd /tmp/innbbsd-$(VERSION); ln -s innbbsd.c dbzinnbbsd.c)
- (cd /tmp/innbbsd-$(VERSION); ln -s bbslib.c echobbslib.c)
-
-
-distribution:
- rm -rf /tmp/innbbsd-$(VERSION)
- test -d /tmp/innbbsd-$(VERSION) || mkdir /tmp/innbbsd-$(VERSION)
- test -d /tmp/innbbsd-$(VERSION)/innd || mkdir /tmp/innbbsd-$(VERSION)/innd
- rm -f r_port.c
- rm -f dbzserver.c
- rm -f dbzinnbbsd.c
- rm -f echobbslib.c
- cp -r doc hisconvert FEATURES CHANGES README* TODO *.c *.h *.y Makefile boards /tmp/innbbsd-$(VERSION)
- (cd /tmp/innbbsd-$(VERSION); ln -s port.c r_port.c)
- (cd /tmp/innbbsd-$(VERSION); ln -s inndchannel.c dbzserver.c)
- (cd /tmp/innbbsd-$(VERSION); ln -s innbbsd.c dbzinnbbsd.c)
- (cd /tmp/innbbsd-$(VERSION); ln -s bbslib.c echobbslib.c)
- (cd innd ; cp -r Makefile README innbbs.conf in.bntpd mailpost *.pl bntplink bntplink.palmbbs *.active* *.c *.y *.bbs src /tmp/innbbsd-$(VERSION)/innd)
- (cd /tmp/innbbsd-$(VERSION); make clean)
- (cd /tmp; tar zcf innbbsd-$(VERSION).tar.gz innbbsd-$(VERSION) )
- ln -s port.c r_port.c
- ln -s inndchannel.c dbzserver.c
- ln -s innbbsd.c dbzinnbbsd.c
- ln -s bbslib.c echobbslib.c
+.include "../pttbbs.mk"
-remotetest: distribution
- /usr/local/krb4/rcp /tmp/innbbsd-$(VERSION).tar.gz bbs_src.tar.gz skhuang:/tmp
- /usr/local/krb4/rcp /tmp/innbbsd-$(VERSION).tar.gz bbs_src.tar.gz linux:/tmp
- mv /u/staff/skhuang/.tcshrc /u/staff/skhuang/skhuang.tcshrc
- rcp /tmp/innbbsd-$(VERSION).tar.gz bbs_src.tar.gz ccsun36:/tmp
- rcp /tmp/innbbsd-$(VERSION).tar.gz bbs_src.tar.gz ccibm1:/tmp
- mv /u/staff/skhuang/skhuang.tcshrc /u/staff/skhuang/.tcshrc
- rcp /tmp/innbbsd-$(VERSION).tar.gz bbs_src.tar.gz cciris3:/tmp
+VERSION= 0.50-pttpatch
+ADMINUSER?= root@your.domain.name
-ftp: distribution patch
- rsh ccsun42 mv /home8/ftp/pub/bbs/misc/innbbsd/innbbsd-$(VERSION).tar.gz /home8/ftp/pub/bbs/misc/innbbsd/.innbbsd-$(VERSION).tar.gz
- rcp /tmp/innbbsd-$(VERSION).tar.gz ccsun42:/home8/ftp/pub/bbs/misc/innbbsd
- rcp README* ccsun42:/home8/ftp/pub/bbs/misc/innbbsd
- rcp /tmp/innbbsd-patch.$(LASTVERSION)-$(VERSION) ccsun42:/home8/ftp/pub/bbs/misc/innbbsd
+# FreeBSD innbbsd肂惠把计
+inn_CFLAGS_FreeBSD= -DBSD44 -DMMAP -DGETRUSAGE
+inn_LDFLAGS_FreeBSD= -L/usr/local/lib -lcrypt -liconv
-innbbspost.o: innbbspost.c
- $(CC) $(CFLAGS) -I$(BBS_SRC) -c innbbspost.c
+# Linux innbbsd肂惠把计
+inn_CFLAGS_Linux= -DLINUX -DGETRUSAGE
+inn_LDFLAGS_Linux=
-makedbz: $(MOBJS)
- $(CC) $(OPT) -o makedbz $(MOBJS) $(LDFLAGS)
+# Solarisinnbbsd肂惠把计
+inn_CFLAGS_Solaris= -DMMAP -DSolaris -DSYSV -I/usr/local/include/
+inn_LDFLAGS_Solaris= -L/usr/local/lib -liconv -lsocket -lnsl -lkstat
-dbzserver.o: dbzserver.c
- $(CC) $(CFLAGS) -DDBZSERVER -I$(BBS_SRC) -c dbzserver.c
+CFLAGS+= -DVERSION=\"$(VERSION)\" \
+ -DADMINUSER=\"$(ADMINUSER)\" \
+ -DMapleBBS -DDBZDEBUG -I. \
+ $(inn_CFLAGS_$(OSTYPE))
+LDFLAGS+= $(inn_LDFLAGS_$(OSTYPE))
-dbzinnbbsd.o: dbzinnbbsd.c
- $(CC) $(CFLAGS) -DDBZSERVER -I$(BBS_SRC) -c dbzinnbbsd.c
+PROGS= bbslink bbsnnrp ctlinnbbsd \
+ innbbsd mkhistory
-dbzserver: $(DBZOBJS)
- $(CC) $(OPT) -o dbzserver $(DBZOBJS) $(LDFLAGS)
+all: $(PROGS)
-bbsnnrp: $(NNRPOBJS)
- $(CC) -o bbsnnrp $(NNRPOBJS) $(OPT) $(LDFLAGS)
+# bbs util
+UTIL_DIR= ../util
+UTIL_OBJS= \
+ util_cache.o util_record.o util_passwd.o util_var.o \
+ util_stuff.o util_osdep.o util_args.o util_file.o
-bbslink: $(LINKOBJS)
- $(CC) -o bbslink $(LINKOBJS) $(OPT) $(LDFLAGS)
+.for fn in ${UTIL_OBJS}
+LINK_UTIL_OBJS+= ${UTIL_DIR}/${fn}
-bbslink2: $(LINKOBJS2)
- $(CC) -o bbslink2 $(LINKOBJS2) $(OPT) $(LDFLAGS)
-
-ctlinnbbsd: $(CTLOBJS)
- $(CC) $(OPT) -o ctlinnbbsd $(CTLOBJS) $(LDFLAGS)
-
-mkhistory: $(HOBJS)
- $(CC) $(OPT) -o mkhistory $(HOBJS) $(LDFLAGS)
-
-dbz_query_sample: dbz_query_sample.o
- $(CC) $(OPT) -o dbz_query_sample dbz_query_sample.o $(LDFLAGS)
-
-
-innbbsd: $(OBJS)
-# mv tnrpd.exe tnrpd.exe.old
- $(CC) -o innbbsd $(OBJS) $(OPT) $(LDFLAGS)
-
-install: $(EXES)
+${UTIL_DIR}/${fn}: # FIXME: dependency
+ cd ${UTIL_DIR}; make ${fn}
+.endfor
+
+
+innbbsd: inndchannel.o innbbsd.o connectsock.o rfc931.o daemon.o file.o pmain.o his.o dbz.o closeonexec.o dbztool.o inntobbs.o receive_article.o echobbslib.o str_decode.o nocem.o
+ $(CCACHE) ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS}
+
+bbslink: bbslink.o pmain.o inntobbs.o echobbslib.o connectsock.o \
+ file.o port.o str_decode.o
+ $(CCACHE) ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS}
+
+bbsnnrp: bbsnnrp.o pmain.o bbslib.o connectsock.o file.o
+ $(CCACHE) ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS}
+
+ctlinnbbsd: ctlinnbbsd.o pmain.o bbslib.o connectsock.o file.o
+ $(CCACHE) ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS}
+
+mkhistory: mkhistory.o bbslib.o file.o his.o dbz.o port.o closeonexec.o
+ $(CCACHE) ${CC} -o $@ ${LDFLAGS} $? ${LINK_UTIL_OBJS}
+
+install: $(PROGS)
install -d $(BBSHOME)/innd/
- install -c -m 755 $(EXES) $(BBSHOME)/innd/
+ install -c -m 755 $(PROGS) $(BBSHOME)/innd/
clean:
- rm -f *.o $(EXES) core innd/src/*.o
+ rm -f *.o $(PROGS) core *.core