tmac.tbl: invoke tblmac macros after adjusting in and ll
[neatroff_make.git] / Makefile
blobb7f00f9a96768acd8e2e4615fce7956a9b6deb08
1 # Neatroff top-level Makefile
3 # Neatroff base directory
4 BASE = $(PWD)
6 # There is no need to install it, but if you wish it, this is the location.
7 #BASE = /opt/share/neatroff
9 INSTALL = install
10 MKDIR = mkdir -p -m 755
11 PWD = $${PWD}
13 all: help
15 help:
16 @echo "Neatroff top-level makefile"
17 @echo
18 @echo " init Initialise git repositories and fonts"
19 @echo " init_fa Initialise for Farsi"
20 @echo " neat Compile the programs and generate the fonts"
21 @echo " pull Update git repositories (git pull)"
22 @echo " clean Remove the generated files"
23 @echo " install Install Neatroff in $(DESTDIR)$(BASE)"
24 @echo
26 init:
27 @echo "Cloning Git repositories"
28 @test -d neatroff || git clone https://github.com/aligrudi/neatroff.git
29 @test -d neatpost || git clone https://github.com/aligrudi/neatpost.git
30 @test -d neatmkfn || git clone https://github.com/aligrudi/neatmkfn.git
31 @test -d neateqn || git clone https://github.com/aligrudi/neateqn.git
32 @test -d neatrefer || git clone https://github.com/aligrudi/neatrefer.git
33 @test -d troff || git clone https://github.com/aligrudi/troffp9.git troff
34 @echo "Downloading fonts"
35 @cd fonts && sh ./fonts.sh
37 init_fa: init
38 @cd fonts && sh ./fonts_fa.sh
40 pull:
41 cd neatroff && git pull
42 cd neatpost && git pull
43 cd neatmkfn && git pull
44 cd neateqn && git pull
45 cd neatrefer && git pull
46 cd troff && git pull
47 git pull
49 comp:
50 @echo "Compiling programs"
51 @base="$(BASE)" && cd neatroff && $(MAKE) FDIR="$$base" MDIR="$$base/tmac"
52 @base="$(BASE)" && cd neatpost && $(MAKE) FDIR="$$base" MDIR="$$base/tmac"
53 @cd neateqn && $(MAKE)
54 @cd neatmkfn && $(MAKE)
55 @cd neatrefer && $(MAKE)
56 @cd troff/pic && $(MAKE)
57 @cd troff/tbl && $(MAKE)
58 @cd soin && $(MAKE)
59 @cd shape && $(MAKE)
61 neat: comp
62 @echo "Generating font descriptions"
63 @pwd="$(PWD)" && cd neatmkfn && ./gen.sh "$$pwd/fonts" "$$pwd/devutf" >/dev/null
65 install:
66 @echo "Copying binaries to $(DESTDIR)$(BASE)"
67 @$(MKDIR) "$(DESTDIR)$(BASE)/neatroff"
68 @$(MKDIR) "$(DESTDIR)$(BASE)/neatpost"
69 @$(MKDIR) "$(DESTDIR)$(BASE)/neateqn"
70 @$(MKDIR) "$(DESTDIR)$(BASE)/neatmkfn"
71 @$(MKDIR) "$(DESTDIR)$(BASE)/neatrefer"
72 @$(MKDIR) "$(DESTDIR)$(BASE)/troff/pic"
73 @$(MKDIR) "$(DESTDIR)$(BASE)/troff/tbl"
74 @$(MKDIR) "$(DESTDIR)$(BASE)/soin"
75 @$(MKDIR) "$(DESTDIR)$(BASE)/shape"
76 @$(MKDIR) "$(DESTDIR)$(BASE)/share/man/man1"
77 @$(INSTALL) neatroff/roff "$(DESTDIR)$(BASE)/neatroff/"
78 @$(INSTALL) neatpost/post "$(DESTDIR)$(BASE)/neatpost/"
79 @$(INSTALL) neatpost/pdf "$(DESTDIR)$(BASE)/neatpost/"
80 @$(INSTALL) neateqn/eqn "$(DESTDIR)$(BASE)/neateqn/"
81 @$(INSTALL) neatmkfn/mkfn "$(DESTDIR)$(BASE)/neatmkfn/"
82 @$(INSTALL) neatrefer/refer "$(DESTDIR)$(BASE)/neatrefer/"
83 @$(INSTALL) soin/soin "$(DESTDIR)$(BASE)/soin/"
84 @$(INSTALL) shape/shape "$(DESTDIR)$(BASE)/shape/"
85 @$(INSTALL) troff/pic/pic "$(DESTDIR)$(BASE)/troff/pic/"
86 @$(INSTALL) troff/tbl/tbl "$(DESTDIR)$(BASE)/troff/tbl/"
87 @$(INSTALL) man/neateqn.1 "$(DESTDIR)$(BASE)/share/man/man1"
88 @$(INSTALL) man/neatmkfn.1 "$(DESTDIR)$(BASE)/share/man/man1"
89 @$(INSTALL) man/neatpost.1 "$(DESTDIR)$(BASE)/share/man/man1"
90 @$(INSTALL) man/neatrefer.1 "$(DESTDIR)$(BASE)/share/man/man1"
91 @$(INSTALL) man/neatroff.1 "$(DESTDIR)$(BASE)/share/man/man1"
92 @echo "Copying font descriptions to $(DESTDIR)$(BASE)/tmac"
93 @$(MKDIR) "$(DESTDIR)$(BASE)/tmac"
94 @cp -r tmac/* "$(DESTDIR)$(BASE)/tmac/"
95 @find "$(DESTDIR)$(BASE)/tmac" -type d -exec chmod 755 {} \;
96 @find "$(DESTDIR)$(BASE)/tmac" -type f -exec chmod 644 {} \;
97 @echo "Copying devutf device to $(DESTDIR)$(BASE)/devutf"
98 @$(MKDIR) "$(DESTDIR)$(BASE)/devutf"
99 @cp devutf/* "$(DESTDIR)$(BASE)/devutf/"
100 @chmod 644 "$(DESTDIR)$(BASE)/devutf"/*
101 @echo "Copying fonts to $(DESTDIR)$(BASE)/fonts"
102 @$(MKDIR) "$(DESTDIR)$(BASE)/fonts"
103 @cp fonts/* "$(DESTDIR)$(BASE)/fonts/"
104 @chmod 644 "$(DESTDIR)$(BASE)/fonts"/*
105 @echo "Updating fontpath in font descriptions"
106 @for f in "$(DESTDIR)$(BASE)/devutf"/*; do sed "/^fontpath /s=$(PWD)/fonts=$(BASE)/fonts=" <$$f >.fd.tmp; mv .fd.tmp $$f; done
108 clean:
109 @cd neatroff && $(MAKE) clean
110 @cd neatpost && $(MAKE) clean
111 @cd neateqn && $(MAKE) clean
112 @cd neatmkfn && $(MAKE) clean
113 @cd neatrefer && $(MAKE) clean
114 @cd troff/tbl && $(MAKE) clean
115 @cd troff/pic && $(MAKE) clean
116 @cd soin && $(MAKE) clean
117 @test ! -d shape || (cd shape && $(MAKE) clean)
118 @rm -fr $(PWD)/devutf