rework the makefiles

master
Michele Guerini Rocco 2019-05-15 18:10:18 +02:00
parent 92c0d44303
commit ebd5d43621
Signed by: rnhmjoj
GPG Key ID: 91BE884FBA4B591A
3 changed files with 33 additions and 31 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
tools/bin
tools/obj
example/books

View File

@ -1,10 +1,11 @@
BOOKROOT=..
TOOLSDIR=$(BOOKROOT)/tools
PSDIR=$(BOOKROOT)/ps
YAPP=$(TOOLSDIR)/yapp
MAKEMANIFEST=$(TOOLSDIR)/makemanifest
PSGEN=BOOKROOT=$(BOOKROOT) $(TOOLSDIR)/psgen
INCLUDERES=(cd $(PSDIR); includeres)
BOOKROOT = ..
TOOLSDIR = $(BOOKROOT)/tools
PSDIR = $(BOOKROOT)/ps
YAPP = $(TOOLSDIR)/yapp
MAKEMANIFEST = $(TOOLSDIR)/makemanifest
PSGEN = env BOOKROOT=$(BOOKROOT) $(TOOLSDIR)/psgen
INCLUDERES = (cd $(PSDIR); includeres)
code.ps pagenums: filelist footer.ps MANIFEST books
$(PSGEN) -P2 -l3 -DfooterFile=footer.ps filelist pagenums 1 \
@ -16,8 +17,8 @@ books:
MANIFEST: filelist
$(MAKEMANIFEST) $< > $@
clean:
rm -f `cat .gitignore`
gv%: %.ps
gv $<
clean:
rm -f `cat .gitignore`

View File

@ -1,30 +1,28 @@
all: unmunge repair munge
BIN = bin
OBJ = obj
CFLAGS = -g -O -W -Wall
OPT = -g -O -W -Wall
COMMON_OBJS = util.o
BINS = $(addprefix $(BIN)/, unmunge munge repair)
UNMUNGE_OBJS = $(addprefix $(OBJ)/, util.o unmunge.o)
MUNGE_OBJS = $(addprefix $(OBJ)/, util.o munge.o)
REPAIR_OBJS = $(addprefix $(OBJ)/, util.o heap.o mempool.o subst.o repair.o)
UNMUNGE_OBJS = $(COMMON_OBJS) unmunge.o
MUNGE_OBJS = $(COMMON_OBJS) munge.o
REPAIR_OBJS = $(COMMON_OBJS) heap.o mempool.o subst.o repair.o
all: $(BINS)
unmunge: $(UNMUNGE_OBJS)
$(CC) $(OPT) -o $@ $(UNMUNGE_OBJS)
$(BIN)/unmunge: $(UNMUNGE_OBJS)
$(CC) $(CFLAGS) -o $@ $(UNMUNGE_OBJS)
munge: $(MUNGE_OBJS)
$(CC) $(OPT) -o $@ $(MUNGE_OBJS)
$(BIN)/munge: $(MUNGE_OBJS)
$(CC) $(CFLAGS) -o $@ $(MUNGE_OBJS)
repair: $(REPAIR_OBJS)
$(CC) $(OPT) -o $@ $(REPAIR_OBJS)
$(BIN)/repair: $(REPAIR_OBJS)
$(CC) $(CFLAGS) -o $@ $(REPAIR_OBJS)
.c.o:
$(CC) $(OPT) -o $@ -c $<
$(OBJ)/%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
-rm -f *.o munge unmunge repair core *.core
rm -f $(OBJ)/* $(BIN)/*.core
unmunge.o: util.h
munge.o: util.h
repair.o: heap.h mempool.h util.h subst.h
heap.o: heap.h
mempool.o: mempool.h
subst.o: subst.h
cleaner:
rm -f $(BIN)/* $(OBJ)/* $(BIN)/*.core