MORECFLAGS=-DUSE_SCANDIR -DEXPIRES_DBZ -DCNEWS # -g
# =()<@<INCLUDE>@>()=
include ../include/config.make
# LDFLAGS=-g

BINS=dexpire runexp histtrim
PROGS=$(BINS) dodexpire dohisttrim expiredaemon splist.awk
DEST=$(NEWSBIN)/expire
EGS=dexplist.eg spacelist.eg
ALL=$(PROGS) $(EGS)

all:	$(ALL)
	$(MX) $(PROGS)

install:	$(PROGS)
	$(MKDIR) $(DEST)
	$(TO) $(DEST) $(PROGS)

setup:	dexplist.eg spacelist.eg
	$(TO) -n -e $(NEWSCTL) $(EGS)
	rm -f $(NEWSCTL)/expires $(NEWSCTL)/expires.dir $(NEWSCTL)/expires.pag

cmp:	$(ALL)
	@$(IN) $(DEST) $(PROGS)
	@$(IN) -i -e $(NEWSCTL) $(EGS)

$(BINS):	$(LIB)

DOBJS= dexpire.o version.o file.o disk.o util.o scannumdir.o
HOBJS= histtrim.o hash.o getdate.o util.o
ROBJS= runexp.o getdate.o util.o


dodexpire: dodexpire.SH funcs.SH
	sh dodexpire.SH C > dodexpire
	sh ../conf/subst -f ../conf/substitutions dodexpire

dohisttrim: dohisttrim.SH funcs.SH
	sh dohisttrim.SH C > dohisttrim
	sh ../conf/subst -f ../conf/substitutions dohisttrim

expiredaemon: expiredaemon.SH funcs.SH
	sh expiredaemon.SH C > expiredaemon
	sh ../conf/subst -f ../conf/substitutions expiredaemon

dexpire: $(DOBJS)
	$(CC) $(LDFLAGS) $(DOBJS) $(LIBS) -o $@

histtrim: $(HOBJS)
	$(CC) $(LDFLAGS) $(HOBJS) $(LIBS) -o $@

runexp: $(ROBJS)
	$(CC) $(LDFLAGS) $(ROBJS) $(LIBS) -o $@

getdate.c: getdate.y
	: expect 10 shift/reduce conflicts
	yacc getdate.y
	mv -f y.tab.c getdate.c

lint:

r:

rclean:

clean:	rclean
	rm -f *.o $(BINS) dodexpire dohisttrim expiredaemon

