diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-15 16:20:05 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-15 16:20:05 +0800 |
commit | fd82d08d8e1f8541713c55866f5578e2ba75fb1c (patch) | |
tree | af44c1e7654a4f640330bbe9451deabc0691511d | |
parent | b1575031b5c9da036d2f33053691d0fdc4ed43df (diff) | |
download | pttbbs-fd82d08d8e1f8541713c55866f5578e2ba75fb1c.tar pttbbs-fd82d08d8e1f8541713c55866f5578e2ba75fb1c.tar.gz pttbbs-fd82d08d8e1f8541713c55866f5578e2ba75fb1c.tar.bz2 pttbbs-fd82d08d8e1f8541713c55866f5578e2ba75fb1c.tar.lz pttbbs-fd82d08d8e1f8541713c55866f5578e2ba75fb1c.tar.xz pttbbs-fd82d08d8e1f8541713c55866f5578e2ba75fb1c.tar.zst pttbbs-fd82d08d8e1f8541713c55866f5578e2ba75fb1c.zip |
use pttbbs.mk
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@847 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/Makefile | 53 | ||||
-rw-r--r-- | pttbbs.mk | 52 | ||||
-rw-r--r-- | util/Makefile | 200 |
3 files changed, 95 insertions, 210 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile index a3d17c64..c4c5c320 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -1,55 +1,6 @@ -# $Id: Makefile,v 1.24 2003/05/01 08:19:23 in2 Exp $ +# $Id: Makefile,v 1.25 2003/05/15 08:20:05 in2 Exp $ -# 訂義基本初值 -BBSHOME?= $(HOME) -BBSHOME?= /home/bbs -OSTYPE?= FreeBSD -CC?= gcc -PTT_CFLAGS= -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I../include -PTT_LDFLAGS= -pipe -Wall -PTT_LIBS= -lcrypt - -# 在 CFLAGS內加入定義 COMPILE_TIME -PTT_CFLAGS+= "-DCOMPILE_TIME=\"`date`\"" - -# 稍後再 enable assert() -PTT_CFLAGS+= -DNDEBUG - -# FreeBSD特有的環境 -CFLAGS_FreeBSD= -DHAVE_SETPROCTITLE -DFreeBSD -LDFLAGS_FreeBSD= -LIBS_FreeBSD= -lkvm - -# Linux特有的環境 -CFLAGS_linux= -DHAVE_DES_CRYPT -DLinux -LDFLAGS_linux= -pipe -Wall -LIBS_linux= - -# CFLAGS, LDFLAGS, LIBS 加入 OS 相關參數 -PTT_CFLAGS+= $(CFLAGS_$(OSTYPE)) -PTT_LDFLAGS+= $(LDFLAGS_$(OSTYPE)) -PTT_LIBS+= $(LIBS_$(OSTYPE)) - -# 若有定義 GDB或 DEBUG, 則加入 -g , 否則用 -O -.if defined(GDB) || defined(DEBUG) -CFLAGS= -g $(PTT_CFLAGS) -LDFLAGS= -g $(PTT_LDFLAGS) $(PTT_LIBS) -.else -CFLAGS+= -O2 -Os -fomit-frame-pointer -fstrength-reduce \ - -fthread-jumps -fexpensive-optimizations \ - $(PTT_CFLAGS) -LDFLAGS+= -O2 $(PTT_LDFLAGS) $(PTT_LIBS) -.endif - -# 若有定義 DEBUG, 則在 CFLAGS內定義 DEBUG -.if defined(DEBUG) -CFLAGS+= -DDEBUG -.endif - -# 若有定義 NO_FORK, 則在 CFLAGS內定義 NO_FORK -.if defined(NO_FORK) -CFLAGS+= -DNO_FORK -.endif +.include "../pttbbs.mk" PROG= mbbsd OBJS= admin.o announce.o args.o bbs.o board.o cache.o cal.o card.o\ diff --git a/pttbbs.mk b/pttbbs.mk new file mode 100644 index 00000000..a246651c --- /dev/null +++ b/pttbbs.mk @@ -0,0 +1,52 @@ +# $Id: pttbbs.mk,v 1.1 2003/05/15 08:20:05 in2 Exp $ +# 訂義基本初值 +BBSHOME?= $(HOME) +BBSHOME?= /home/bbs +OSTYPE?= FreeBSD +CC?= gcc +PTT_CFLAGS= -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I../include +PTT_LDFLAGS= -pipe -Wall +PTT_LIBS= -lcrypt + +# 在 CFLAGS內加入定義 COMPILE_TIME +PTT_CFLAGS+= "-DCOMPILE_TIME=\"`date`\"" + +# 稍後再 enable assert() +PTT_CFLAGS+= -DNDEBUG + +# FreeBSD特有的環境 +CFLAGS_FreeBSD= -DHAVE_SETPROCTITLE -DFreeBSD +LDFLAGS_FreeBSD= +LIBS_FreeBSD= -lkvm + +# Linux特有的環境 +CFLAGS_linux= -DHAVE_DES_CRYPT -DLinux +LDFLAGS_linux= -pipe -Wall +LIBS_linux= + +# CFLAGS, LDFLAGS, LIBS 加入 OS 相關參數 +PTT_CFLAGS+= $(CFLAGS_$(OSTYPE)) +PTT_LDFLAGS+= $(LDFLAGS_$(OSTYPE)) +PTT_LIBS+= $(LIBS_$(OSTYPE)) + +# 若有定義 GDB或 DEBUG, 則加入 -g , 否則用 -O +.if defined(GDB) || defined(DEBUG) +CFLAGS= -g $(PTT_CFLAGS) +LDFLAGS= -g $(PTT_LDFLAGS) $(PTT_LIBS) +.else +CFLAGS+= -O2 -Os -fomit-frame-pointer -fstrength-reduce \ + -fthread-jumps -fexpensive-optimizations \ + $(PTT_CFLAGS) +LDFLAGS+= -O2 $(PTT_LDFLAGS) $(PTT_LIBS) +.endif + +# 若有定義 DEBUG, 則在 CFLAGS內定義 DEBUG +.if defined(DEBUG) +CFLAGS+= -DDEBUG +.endif + +# 若有定義 NO_FORK, 則在 CFLAGS內定義 NO_FORK +.if defined(NO_FORK) +CFLAGS+= -DNO_FORK +.endif + diff --git a/util/Makefile b/util/Makefile index d94eb736..deecbd2b 100644 --- a/util/Makefile +++ b/util/Makefile @@ -1,172 +1,59 @@ -# $Id: Makefile,v 1.28 2003/04/05 13:09:03 in2 Exp $ +# $Id: Makefile,v 1.29 2003/05/15 08:20:05 in2 Exp $ -# 訂義基本初值 -BBSHOME?= $(HOME) -BBSHOME?= /home/bbs -OSTYPE?= FreeBSD -CC?= gcc -CFLAGS+= -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I../include -LDFLAGS+= -pipe -Wall -LIBS+= -lcrypt +.include "../pttbbs.mk" -# FreeBSD特有的環境 -CFLAGS_FreeBSD= -DHAVE_SETPROCTITLE -DFreeBSD -LDFLAGS_FreeBSD= -LIBS_FreeBSD= -lkvm +UTIL_OBJS= \ + util_cache.o util_record.o util_passwd.o -# Linux特有的環境 -CFLAGS_linux= -DHAVE_DES_CRYPT -DLinux -LDFLAGS_linux= -pipe -Wall -LIBS_linux= -lresolv +CPROG_WITH_UTIL= \ + bbsmail BM_money post poststat \ + jungo account birth deluserfile \ + expire mandex rmuid horoscope \ + openvice parse_news openticket topusr \ + indexuser yearsold toplazyBM toplazyBBM \ + reaper buildAnnounce inndBM shmctl -# CFLAGS, LDFLAGS, LIBS 加入 OS 相關參數 -CFLAGS+= $(CFLAGS_$(OSTYPE)) -LDFLAGS+= $(LDFLAGS_$(OSTYPE)) -LIBS+= $(LIBS_$(OSTYPE)) +CPROG_WITHOUT_UTIL= \ + shmsweep uhash_loader showboard antispam \ + countalldice webgrep bbsrf initbbs \ + userlist tunepasswd buildir merge_passwd \ + merge_board xchatd outmail -OBJS= util_cache.o util_record.o util_passwd.o +PROGS= ${UTIL_OBJS} ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} \ + BM_money.sh backpasswd.sh mailog.sh opendice.sh \ + openticket.sh stock.sh topsong.sh weather.sh \ + stock.perl weather.perl toplazyBM.sh toplazyBBM.sh \ + dailybackup.pl tarqueue.pl waterball.pl filtermail.pl \ + getbackup.pl udnnews.pl rebuildaloha.pl railway_wrapper.pl -CPROGS= bbsmail BM_money post account birth deluserfile expire mandex\ - horoscope openvice parse_news openticket topusr yearsold uhash_loader\ - poststat showboard antispam countalldice webgrep bbsrf\ - initbbs outmail xchatd userlist tunepasswd buildir reaper shmsweep\ - merge_passwd merge_board inndBM buildAnnounce rmuid \ - toplazyBM jungo toplazyBBM shmctl indexuser +all: ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} ${PROGS} -PROGS= $(CPROGS) BM_money.sh backpasswd.sh mailog.sh opendice.sh\ - openticket.sh stock.sh topsong.sh weather.sh stock.perl weather.perl\ - toplazyBM.sh toplazyBBM.sh dailybackup.pl tarqueue.pl waterball.pl \ - filtermail.pl getbackup.pl udnnews.pl rebuildaloha.pl railway_wrapper.pl - -.if ${OSTYPE} == "FreeBSD" -CPROGS += diskstat -.endif - -all: $(PROGS) - -bbsmail: bbsmail.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -BM_money: BM_money.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -post: post.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -poststat: poststat.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -jungo: jungo.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -account: account.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -birth: birth.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -deluserfile: deluserfile.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -expire: expire.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -mandex: mandex.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -rmuid: rmuid.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -horoscope: horoscope.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -openvice: openvice.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -parse_news: parse_news.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -openticket: openticket.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -topusr: topusr.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -indexuser: indexuser.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -yearsold: yearsold.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) +.for fn in ${CPROG_WITH_UTIL} +${fn}: ${fn}.c ${UTIL_OBJS} + ${CC} ${CFLAGS} -o ${fn} ${fn}.c ${UTIL_OBJS} +.endfor xchatd: xchatd.c $(OBJS) descrypt.c $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) descrypt.c $(LIBCHAT) -toplazyBM: toplazyBM.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -toplazyBBM: toplazyBBM.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -smtest: smtest.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -reaper: reaper.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -buildAnnounce: buildAnnounce.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -inndBM: inndBM.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) - -shmsweep: shmsweep.c - $(CC) $(CFLAGS) -o $@ $@.c - -uhash_loader: uhash_loader.c - $(CC) $(CFLAGS) -o $@ $@.c - -showboard: showboard.c - $(CC) $(CFLAGS) -o $@ $@.c - -antispam: antispam.c - $(CC) $(CFLAGS) -o $@ $@.c - -countalldice: countalldice.c - $(CC) $(CFLAGS) -o $@ $@.c - -webgrep: webgrep.c - $(CC) $(CFLAGS) -o $@ $@.c - -bbsrf: bbsrf.c - $(CC) $(CFLAGS) -o $@ $@.c - -initbbs: initbbs.c - $(CC) $(CFLAGS) -o $@ $@.c - outmail: outmail.c $(CC) $(CFLAGS) -o $@ $@.c $(LIBMAIL) -userlist: userlist.c - $(CC) $(CFLAGS) -o $@ $@.c - -tunepasswd: tunepasswd.c - $(CC) $(CFLAGS) -o $@ $@.c - -buildir: buildir.c - $(CC) $(CFLAGS) -o $@ $@.c - -merge_passwd: merge_passwd.c - $(CC) $(CFLAGS) -o $@ $@.c +install: $(PROGS) + install -d $(BBSHOME)/bin/ + install -c -m 755 $(PROGS) $(BBSHOME)/bin/ + chmod 4755 $(BBSHOME)/bin/post -merge_board : merge_board.c - $(CC) $(CFLAGS) -o $@ $@.c +clean: + rm -f *.o $(CPROGS) $(CPROG_WITH_UTIL) $(CPROG_WITHOUT_UTIL) -bbsctl: bbsctl.c - $(CC) $(CFLAGS) -o $@ $@.c -shmctl: shmctl.c $(OBJS) - $(CC) $(CFLAGS) -o $@ $@.c $(OBJS) +installfiltermail: + mv $(BBSHOME)/bin/bbsmail $(BBSHOME)/bin/realbbsmail + ln -s $(BBSHOME)/bin/filtermail.pl $(BBSHOME)/bin/bbsmail +# for diskstat(FreeBSD 4.x only) . +# diskstat should be compiled with bbs and installed with root diskstat: diskstat.c $(CC) $(CFLAGS) -o diskstat diskstat.c -ldevstat -lkvm @@ -175,12 +62,9 @@ installdiskstat: diskstat chgrp kmem /usr/local/bin/diskstat chmod 2755 /usr/local/bin/diskstat -install: $(PROGS) - install -d $(BBSHOME)/bin/ - install -c -m 755 $(PROGS) $(BBSHOME)/bin/ - chmod 4755 $(BBSHOME)/bin/post - #mv $(BBSHOME)/bin/bbsmail $(BBSHOME)/bin/realbbsmail - #ln -s $(BBSHOME)/bin/filtermail.pl $(BBSHOME)/bin/bbsmail +# for bbsctl. bbsctl should be compiled with bbs and installed with root +bbsctl: bbsctl.c + $(CC) $(CFLAGS) -o $@ $@.c installbbsctl: bbsctl rm -f /home/bbs/bin/bbsctl @@ -188,5 +72,3 @@ installbbsctl: bbsctl chown root /home/bbs/bin/bbsctl chmod 4755 /home/bbs/bin/bbsctl -clean: - rm -f *.o $(CPROGS) |