1#######################################################################
2#
3#	@(#)Makefile	1.8	(CWI)	93/07/27
4#
5# Makefile for ditroff and nroff
6#
7#######################################################################
8
9CFLAGS = -DINCORE -O
10NFLAGS = -DNROFF -DSMALLER	# additional flags for nroff compile
11
12# location to install final output
13
14BINDIR = /usr/local/bin
15LIBDIR = /usr/local/libdata/ditroff_font
16LIBXDIR = /usr/local/libexec
17MANDIR = /usr/local/man/manl
18
19# the directories where the .o files are stored
20
21N = nrobs
22T = trobs
23
24# the object files needed by nroff and troff
25
26NOBS = $N/n1.o $N/n2.o $N/n3.o $N/n4.o $N/n5.o $N/n6.o $N/n7.o $N/n8.o \
27       $N/n9.o $N/n10.o $N/ni.o $N/nii.o $N/hytab.o $N/suftab.o
28
29TOBS = $T/n1.o $T/n2.o $T/n3.o $T/n4.o $T/n5.o $T/t6.o $T/n7.o $T/n8.o \
30       $T/n9.o $T/t10.o $T/ni.o $T/nii.o $T/hytab.o $T/suftab.o
31
32#######################################################################
33
34all:	troff_p
35
36troff_p: $(T) $(TOBS)
37	$(CC) $(CFLAGS) $(TOBS) -o troff_p -lcompat
38
39
40nroff:	$(N) $(NOBS)
41	$(CC) $(CFLAGS) $(NFLAGS) $(NOBS) -o nroff -lcompat
42
43
44$(T):
45	mkdir $(T)
46
47$(N):
48	mkdir $(N)
49
50$(LIBDIR):
51	mkdir $(LIBDIR)
52
53install: all $(LIBDIR)
54	install -s ditroff $(DESTDIR)$(LIBXDIR)/troff_p
55#	install -s nroff $(DESTDIR)$(BINDIR)/nroff
56#	install -c -m 664 ditroff.1 $(DESTDIR)$(MANDIR)/ditroff.1
57
58clean:  force
59	rm -rf make.out troff_p nroff $N $T
60
61# fake dependency to force a make
62force:
63
64
65#######################################################################
66#
67# The dependencies are divided into two parts: the
68# first expresses the dependencies between the files
69# and includes the fact that the .o files are in
70# different directories than the .c files.  The 2nd
71# part expresses no dependencies, but contains the
72# rule for compiling the .c files into .o files.
73#
74# File Dependencies:
75#
76
77$T/n1.o:		n1.c  tdef.h tw.h ext.h $T/ni.o
78$N/n1.o:		n1.c  tdef.h tw.h ext.h $N/ni.o
79
80$T/n2.o  $N/n2.o:	n2.c  tdef.h tw.h
81$T/n3.o  $N/n3.o:	n3.c  tdef.h tw.h
82$T/n4.o  $N/n4.o:	n4.c  tdef.h tw.h
83$T/n5.o  $N/n5.o:	n5.c  tdef.h tw.h
84
85$T/t6.o:		t6.c  tdef.h tw.h dev.h $T/ni.o
86$N/n6.o:		n6.c  tdef.h tw.h
87
88$T/n7.o  $N/n7.o:	n7.c  tdef.h tw.h
89$T/n8.o  $N/n8.o:	n8.c  tdef.h tw.h
90$T/n9.o  $N/n9.o:	n9.c  tdef.h tw.h
91
92$T/t10.o:		t10.c tdef.h tw.h dev.h $T/ni.o
93$N/n10.o:		n10.c tdef.h tw.h
94
95$T/ni.o  $N/ni.o:	ni.c  tdef.h tw.h
96$T/nii.o $N/nii.o:	nii.c tdef.h tw.h
97$T/hytab.o $N/hytab.o:	hytab.c
98$T/suftab.o $N/suftab.o: suftab.c
99
100
101#
102# Generation Rule:
103#  .oldestfile is older than everything, so
104#  these rules will not be invoked unless
105#  one of the above dependencies is.]
106#
107
108$(NOBS):  .oldestfile
109	  $(CC) $(CFLAGS) $(NFLAGS) -c `basename $@ .o`.c
110	mv `basename $@` nrobs
111
112$(TOBS):  .oldestfile
113	  $(CC) $(CFLAGS) -c `basename $@ .o`.c
114	mv `basename $@` trobs
115
116.oldestfile:
117	touch .oldestfile
118