chiark / gitweb /
actual makefile stuff for subseg2display
[trains.git] / layout / Makefile
1 include ../cprogs.make
2
3 M4INCS=         parts.i4
4
5 E_TRACK=        ArsCLMNo
6 LAYOUTOPTS_ALL= -ep=*Cm
7 LAYOUTOPTS=     -E=*$(E_TRACK) $(LAYOUTOPTS_ALL)
8 LAYOUTOPTS_PHYS= -S1.0 $(LAYOUTOPTS) '-e*A'
9 XLAYOUTOPTS_LAYER= -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l'
10
11 LAYOUTOPTS_SEGS= '-e*=*rm' '-e=5G'
12
13 LAYERS_LS=      0 10 20
14 LAYERS_PS=      $(addsuffix .ps, $(LAYERS_LS))
15 LAYERS_L=       $(addprefix ours-l, $(LAYERS_PS))
16 LAYERS_E=       $(addprefix ours-e, $(LAYERS_PS))
17 LAYERS=         $(LAYERS_L) $(LAYERS_E)
18
19 LPAGES=  $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps))
20
21 CPROGS=         subseg2display
22
23 default:        $(CPROGS)
24 all:            default lpages layers
25
26 layers:         $(LAYERS)
27 lpages:         $(LPAGES)
28
29 o=>$@.new && mv -f $@.new $@
30
31 subseg2display: subseg2display.o
32                 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS) -lnetpbm -lpub
33
34 %.d4:           %.m4 $(M4INCS) Makefile
35                 m4 -s <$< $o
36
37 %-a.ps:         %.d4 layout
38                 ./layout <$< $(LAYOUTOPTS) '-E*l' $o
39
40 %-al.ps:        %.d4 layout
41                 ./layout <$< $(LAYOUTOPTS) '-e*C' '-ep=rm' $o
42
43 %-ap.ps:        %.d4 layout
44                 ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o
45
46 ours-g%.ps:     ours.d4 ours-g%.segcmap layout
47                 ./layout <$< -l$* $(LAYOUTOPTS_SEGS) -GLours-g$*.segcmap $o
48
49 ours-g%.segcmap: ours-g%.segcmapreq segcmapassign
50                 ./segcmapassign <$< $o
51
52 ours-g%.segcmapreq: ours.d4 layout
53                 ./layout <$< -l$* $(LAYOUTOPTS_SEGS) -GR $o
54
55 ours-g%.ppm:    ours-g%.ps
56                 gs -dNOPAUSE -dBATCH -dSAFER -q \
57                         -sDEVICE=ppmraw -r72 -g595x842 \
58                         -sOutputFile=$@.new $< && mv -f $@.new $@
59
60 ours-l%.ps:     ours.d4 layout
61                 ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o
62
63 ours-e%.ps:     ours.d4 layout
64                 ./layout <$< -l$* -E'=*aRsclMno' \
65                         -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o
66
67 ours-p%.ps:     ours.d4 layout
68                 ./layout <$< -l$$(printf %s "$*" | sed -e 's/-/ -P/') \
69                         $(LAYOUTOPTS_PHYS) $(XLAYOUTOPTS_LAYER) $o
70
71 parts.ps:       showlib.d4 layout
72                 ./layout <$< $(LAYOUTOPTS_ALL) $o
73
74 clean:
75                 -rm -f -- *.d4 *~ *.new
76                 -rm -f ours-*.ps parts.ps
77                 -rm -f *.oprint-*.ps
78                 -rm -f $(CPROGS) *.o
79
80 .PRECIOUS:      $(OPRINTS)
81 .PRECIOUS:      ours-g%.segcmap ours-g%.segcmapreq