diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-01-01 01:42:23 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-01-01 01:42:23 +0800 |
commit | 6ff013ae039d77074b3f157160c62deab07a5088 (patch) | |
tree | 75d18fcdf068e6fd189151bdb3c91e290081f263 /mbbsd | |
parent | ce591a73e5bafcf08b93da768b8c76c5e824f599 (diff) | |
download | pttbbs-6ff013ae039d77074b3f157160c62deab07a5088.tar pttbbs-6ff013ae039d77074b3f157160c62deab07a5088.tar.gz pttbbs-6ff013ae039d77074b3f157160c62deab07a5088.tar.bz2 pttbbs-6ff013ae039d77074b3f157160c62deab07a5088.tar.lz pttbbs-6ff013ae039d77074b3f157160c62deab07a5088.tar.xz pttbbs-6ff013ae039d77074b3f157160c62deab07a5088.tar.zst pttbbs-6ff013ae039d77074b3f157160c62deab07a5088.zip |
flexible Makefile
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@593 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/Makefile | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile index 5d9d4f2b..33f239b1 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -1,42 +1,51 @@ -# $Id: Makefile,v 1.12 2002/07/05 13:18:27 in2 Exp $ - -BBSHOME?=$(HOME) -OSTYPE=FreeBSD - -# FreeBSD -CFLAGS_FreeBSD= -pipe -Wall -DHAVE_SETPROCTITLE -DBBSHOME='"$(BBSHOME)"' -DFreeBSD -I../include -LDFLAGS_FreeBSD=-pipe -Wall -LIBS_FreeBSD= -lkvm -lcrypt - -# Linux -CFLAGS_linux= -pipe -Wall -DHAVE_DES_CRYPT -DBBSHOME='"$(BBSHOME)"' -DLinux -I../include -s +# $Id: Makefile,v 1.13 2002/12/31 17:42:23 in2 Exp $ + +# 訂義基本初值 +BBSHOME?= $(HOME) +BBSHOME?= /home/bbs +OSTYPE?= FreeBSD +CC?= gcc +CFLAGS+= -Wall -pipe -DBBSHOME='"$(BBSHOME)"' -I../include +LDFLAGS+= -pipe -Wall +LIBS+= -lcrypt + +# 在 CFLAGS內加入定義 COMPILE_TIME +CFLAGS+= "-DCOMPILE_TIME=\"`date`\"" + +# FreeBSD特有的環境 +CFLAGS_FreeBSD= -DHAVE_SETPROCTITLE -DFreeBSD +LDFLAGS_FreeBSD= +LIBS_FreeBSD= -lkvm + +# Linux特有的環境 +CFLAGS_linux= -DHAVE_DES_CRYPT -DLinux LDFLAGS_linux= -pipe -Wall -LIBS_linux= -lcrypt +LIBS_linux= -CFLAGS= $(CFLAGS_$(OSTYPE)) -LDFLAGS=$(LDFLAGS_$(OSTYPE)) -LIBS= $(LIBS_$(OSTYPE)) +# CFLAGS, LDFLAGS, LIBS 加入 OS 相關參數 +CFLAGS+= $(CFLAGS_$(OSTYPE)) +LDFLAGS+= $(LDFLAGS_$(OSTYPE)) +LIBS+= $(LIBS_$(OSTYPE)) +# 若有定義 GDB或 DEBUG, 則加入 -g , 否則用 -O .if defined(GDB) || defined(DEBUG) -CFLAGS+= -g -FDFLAGS+= -g +CFLAGS+= -g +FDFLAGS+= -g .else -CFLAGS+= -O -LDFLAGS+= -O +CFLAGS+= -O +LDFLAGS+= -O .endif +# 若有定義 DEBUG, 則在 CFLAGS內定義 DEBUG .if defined(DEBUG) -CFLAGS+= -DDEBUG -LDFLAGS+= -DDEBUG +CFLAGS+= -DDEBUG .endif +# 若有定義 NO_FORK, 則在 CFLAGS內定義 NO_FORK .if defined(NO_FORK) -CFLAGS+= -DNO_FORK +CFLAGS+= -DNO_FORK .endif -CFLAGS+= "-DCOMPILE_TIME=\"`date`\"" - -CC= gcc PROG= mbbsd OBJS= admin.o announce.o args.o bbs.o board.o cache.o cal.o card.o\ chat.o chc_draw.o chc_net.o chc_play.o chc_rule.o chicken.o dark.o\ @@ -49,12 +58,12 @@ OBJS= admin.o announce.o args.o bbs.o board.o cache.o cal.o card.o\ .SUFFIXES: .c .o .c.o: ../include/var.h - $(CC) $(ADDFLAGS) $(CFLAGS) -c $*.c + $(CC) $(CFLAGS) -c $*.c all: $(PROG) $(PROG): $(OBJS) - $(CC) $(ADDFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) + $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) ../include/var.h: var.c perl ../util/parsevar.pl < var.c > ../include/var.h |