diff options
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | common/Makefile | 9 | ||||
-rw-r--r-- | common/bbs/Makefile | 27 | ||||
-rw-r--r-- | common/sys/Makefile | 21 | ||||
-rw-r--r-- | mbbsd/Makefile | 15 | ||||
-rw-r--r-- | pttbbs.mk | 13 | ||||
-rw-r--r-- | util/Makefile | 19 |
7 files changed, 41 insertions, 76 deletions
@@ -1,14 +1,3 @@ SUBDIR= common mbbsd util innbbsd trans -all install clean: -.if !exists(/usr/local/lib/libhz.so) && !exists(/usr/lib/libhz.so) - @echo "sorry, libhz not found." - @echo "above FreeBSD, please install /usr/ports/chinese/autoconvert" - @echo "above Debian/Linux, please install package libhz0" - @exit 1 -.endif - @for i in $(SUBDIR); do\ - cd $$i;\ - $(MAKE) $@;\ - cd -;\ - done +.include <bsd.subdir.mk> diff --git a/common/Makefile b/common/Makefile index 2fc631d4..5730a479 100644 --- a/common/Makefile +++ b/common/Makefile @@ -1,8 +1,3 @@ -SUBDIR= bbs sys +SUBDIR:= bbs sys -all install clean: - @for i in $(SUBDIR); do\ - cd $$i;\ - $(MAKE) $@;\ - cd -;\ - done +.include <bsd.subdir.mk> diff --git a/common/bbs/Makefile b/common/bbs/Makefile index 99086258..b93cada1 100644 --- a/common/bbs/Makefile +++ b/common/bbs/Makefile @@ -1,26 +1,13 @@ +MKLINT:=no +MKPROFILE:=no +MKPIC:=no -SRCROOT= ../.. +SRCROOT:= ../.. .include "$(SRCROOT)/pttbbs.mk" -OBJS= log.o file.o money.o names.o path.o time.o string.o -# record.o -TARGET= libcmbbs.a - - -.SUFFIXES: .c .o -.c.o: $(SRCROOT)/include/var.h - $(CCACHE) $(DIETCC) $(CC) $(CFLAGS) -c $*.c - -all: $(TARGET) +SRCS:= log.c file.c money.c names.c path.c time.c string.c # record.c +LIB:= cmbbs install: -$(SRCROOT)/include/var.h: $(SRCROOT)/mbbsd/var.c - perl $(SRCROOT)/util/parsevar.pl < $(SRCROOT)/mbbsd/var.c > $(SRCROOT)/include/var.h - -$(TARGET): $(OBJS) - $(AR) cru $@ $(OBJS) - ranlib $@ - -clean: - rm -f $(OBJS) $(TARGET) +.include <bsd.lib.mk> diff --git a/common/sys/Makefile b/common/sys/Makefile index 9c7bb257..39598f86 100644 --- a/common/sys/Makefile +++ b/common/sys/Makefile @@ -1,22 +1,13 @@ +MKLINT:=no +MKPROFILE:=no +MKPIC:=no SRCROOT= ../.. .include "$(SRCROOT)/pttbbs.mk" -OBJS= file.o lock.o log.o net.o sort.o string.o time.o crypt.o osdep.o -TARGET= libcmsys.a - - -.SUFFIXES: .c .o -.c.o: - $(CCACHE) $(DIETCC) $(CC) $(CFLAGS) -c $*.c - -all: $(TARGET) +SRCS:= file.c lock.c log.c net.c sort.c string.c time.c crypt.c osdep.c +LIB:= cmsys install: -$(TARGET): $(OBJS) - $(AR) cru $@ $(OBJS) - ranlib $@ - -clean: - rm -f $(OBJS) $(TARGET) +.include <bsd.lib.mk> diff --git a/mbbsd/Makefile b/mbbsd/Makefile index 127e6c24..b756e7f6 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -17,7 +17,7 @@ PAGEROBJS= more.o pmore.o PLUGOBJS = lovepaper.o calendar.o topsong.o gamble.o vice.o angel.o CHESSOBJS= chc.o chc_tab.o chess.o go.o gomo.o dark.o reversi.o GAMEOBJS = card.o guess.o chicken.o othello.o -OBJS= admin.o assess.o edit.o menu.o xyz.o var.o visio.o \ +OBJS:= admin.o assess.o edit.o menu.o xyz.o var.o visio.o \ vote.o voteboard.o \ $(COREOBJS) $(ACCOBJS) $(NETOBJS) $(TALKOBJS) $(UTILOBJS) \ $(PAGEROBJS) $(PLUGOBJS) \ @@ -73,10 +73,8 @@ OBJS+= screen.o .if defined(DIET) OBJS+= random.o time.o alloc.o -DIETCC= diet -Os +DIETCC:= diet -Os .endif -#CFLAGS+=-g -#CFLAGS+=-std=c99 # reduce .bss align overhead .if !defined(DEBUG) @@ -97,22 +95,19 @@ LDLIBS+=$(SRCROOT)/common/bbs/libcmbbs.a \ .SUFFIXES: .c .o .c.o: $(SRCROOT)/include/var.h - $(CCACHE) $(DIETCC) $(CC) $(CFLAGS) -c $*.c + $(CC) $(CFLAGS) -c $*.c all: $(PROG) $(PROG): $(OBJS) sh $(SRCROOT)/util/newvers.sh - $(DIETCC) $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDLIBS) vers.c - -$(SRCROOT)/include/var.h: var.c - perl $(SRCROOT)/util/parsevar.pl < var.c > $(SRCROOT)/include/var.h + $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDLIBS) vers.c $(SRCROOT)/include/banip.h: $(SRCROOT)/util/banip.pl perl $(SRCROOT)/util/banip.pl > $@ mbbsd.o: mbbsd.c $(SRCROOT)/include/var.h $(SRCROOT)/include/banip.h - $(CCACHE) $(DIETCC) $(CC) $(CFLAGS) -c $< + $(DIETCC) $(CC) $(CFLAGS) -c $< initemaildb: emaildb.c $(CC) -DINIT_MAIN $(CFLAGS) $(LDFLAGS) -o initemaildb emaildb.c $(LDLIBS) @@ -7,8 +7,13 @@ SRCROOT?= . OSTYPE!= uname -CC= gcc +CC:= gcc +CXX:= g++ CCACHE!= which ccache|sed -e 's/^.*\///' +.if $(CCACHE) +CC:= ccache $(CC) +CXX:= ccache $(CXX) +.endif PTT_CFLAGS:= -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I$(SRCROOT)/include PTT_LDFLAGS= @@ -58,3 +63,9 @@ CFLAGS+= -fomit-frame-pointer .if defined(NO_FORK) CFLAGS+= -DNO_FORK .endif + +.MAIN: all + +$(SRCROOT)/include/var.h: $(SRCROOT)/mbbsd/var.c + perl $(SRCROOT)/util/parsevar.pl < $(SRCROOT)/mbbsd/var.c > $(SRCROOT)/include/var.h + diff --git a/util/Makefile b/util/Makefile index 06bcbf73..0ac65178 100644 --- a/util/Makefile +++ b/util/Makefile @@ -50,29 +50,26 @@ LDLIBS+= $(SRCROOT)/common/sys/libcmsys.a \ all: ${CPROG_WITH_UTIL} ${CPROG_WITHOUT_UTIL} ${CPP_WITH_UTIL} ${PROGS} -$(SRCROOT)/include/var.h: $(SRCROOT)/mbbsd/var.c - cd $(SRCROOT)/mbbsd; $(MAKE) $(SRCROOT)/include/var.h - .for fn in ${CPROG_WITH_UTIL} ${fn}: ${BBSBASE} ${fn}.c ${UTIL_OBJS} - $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o ${fn} ${UTIL_OBJS} ${fn}.c $(LDLIBS) + ${CC} ${CFLAGS} ${LDFLAGS} -o ${fn} ${UTIL_OBJS} ${fn}.c $(LDLIBS) .endfor .for fn in ${CPP_WITH_UTIL} ${fn}: ${BBSBASE} ${fn}.cc ${UTIL_OBJS} - $(CCACHE) g++ ${CFLAGS} ${LDFLAGS} -o ${fn} ${UTIL_OBJS} ${fn}.cc $(LDLIBS) + $(CXX) ${CFLAGS} ${LDFLAGS} -o ${fn} ${UTIL_OBJS} ${fn}.cc $(LDLIBS) .endfor .for fn in ${MBBSD_OBJS} util_${fn}.o: ${BBSBASE} $(SRCROOT)/mbbsd/${fn}.c - $(CCACHE) ${CC} ${CFLAGS} -D_BBS_UTIL_C_ -c -o $@ $(SRCROOT)/mbbsd/${fn}.c + ${CC} ${CFLAGS} -D_BBS_UTIL_C_ -c -o $@ $(SRCROOT)/mbbsd/${fn}.c .endfor shmctl: ${BBSBASE} shmctl.c ${UTIL_OBJS} - $(CCACHE) ${CXX} ${CFLAGS} ${LDFLAGS} -o shmctl ${UTIL_OBJS} shmctl.c $(LDLIBS) + ${CXX} ${CFLAGS} ${LDFLAGS} -o shmctl ${UTIL_OBJS} shmctl.c $(LDLIBS) bbsmail: ${BBSBASE} bbsmail.c $(SRCROOT)/innbbsd/str_decode.c $(UTIL_OBJS) - $(CCACHE) $(CC) $(CFLAGS) $(LDFLAGS) -o bbsmail -DUSE_ICONV \ + $(CC) $(CFLAGS) $(LDFLAGS) -o bbsmail -DUSE_ICONV \ bbsmail.c $(SRCROOT)/innbbsd/str_decode.c $(UTIL_OBJS) $(LDLIBS) install: $(PROGS) @@ -94,7 +91,7 @@ installfiltermail: # for diskstat(FreeBSD 4.x only) . # diskstat should be compiled with bbs and installed with root diskstat: diskstat.c - $(CCACHE) $(CC) $(CFLAGS) -o diskstat diskstat.c -ldevstat -lkvm + $(CC) $(CFLAGS) -o diskstat diskstat.c -ldevstat -lkvm installdiskstat: diskstat cp -f diskstat /usr/local/bin/ @@ -103,7 +100,7 @@ installdiskstat: diskstat # for bbsctl. bbsctl should be compiled with bbs and installed with root bbsctl: bbsctl.c - $(CCACHE) $(CC) $(CFLAGS) ${LDFLAGS} -o $@ $@.c $(LDLIBS) + $(CC) $(CFLAGS) ${LDFLAGS} -o $@ $@.c $(LDLIBS) installbbsctl: bbsctl rm -f /home/bbs/bin/bbsctl @@ -112,4 +109,4 @@ installbbsctl: bbsctl chmod 4755 /home/bbs/bin/bbsctl cleanpasswd: cleanpasswd.c ${UTIL_OBJS} - $(CCACHE) ${CC} ${CFLAGS} ${LDFLAGS} -o cleanpasswd ${UTIL_OBJS} cleanpasswd.c + ${CC} ${CFLAGS} ${LDFLAGS} -o cleanpasswd ${UTIL_OBJS} cleanpasswd.c |