chiark / gitweb /
first cut of distance labels
[trains.git] / layout / Makefile
1 include ../cprogs.make
2 include ../common.make
3
4 M4INCS=         parts.i4
5
6 E_TRACK=        ArsCLMNo
7 LAYOUTOPTS_ALL= -ep=*Cm
8 LAYOUTOPTS=     -E=*$(E_TRACK) $(LAYOUTOPTS_ALL)
9 LAYOUTOPTS_PHYS= -S1.0 $(LAYOUTOPTS) '-e*A'
10 XLAYOUTOPTS_LAYER= -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l'
11
12 LAYOUTOPTS_SEGS= '-e*=*rm'
13
14 LAYERS_LS=      0 10 20
15 LAYERS_PS=      $(addsuffix .ps, $(LAYERS_LS))
16 LAYERS_L=       $(addprefix ours-l, $(LAYERS_PS))
17 LAYERS_E=       $(addprefix ours-e, $(LAYERS_PS))
18 LAYERS=         $(LAYERS_L) $(LAYERS_E)
19
20 LPAGES=  $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps))
21
22 CPROGS=         subseg2display compose-segenco
23
24 default:        $(CPROGS) for-test-ui layers extras
25 all:            default lpages
26 for-pic:        ours+pindata.asm
27 recurse:        $(CPROGS) for-pic for-test-ui
28 for-test-ui:    ours.graph.c ours.redactgraph ours.raw.neato.ps \
29                 ours.redacted.neato.ps ours.layout-data.o \
30                 ours.dgram-bot.segcmap ours.dgram-bot.plandata.c \
31                 ours.dgram-bot.plandata.o
32
33 layers:         $(LAYERS)
34 lpages:         $(LPAGES)
35 extras:         ours-a.ps ours-al.ps dualjn-a.ps parts.ps
36
37 include ours.dgram.m
38 include segencolayers.m
39
40 NETPBM =        -lnetpbm
41 ifeq (,$(shell test -f /usr/lib/libppm.so || echo no))
42 NETPBM +=       -lppm
43 endif
44
45 REDACT=         consistency movfeatsplitedges   \
46                 consistency movfeatrmstubs      \
47                 consistency movfeatsplitnodes   \
48                 consistency trivpairnodes       \
49                 consistency trivnullnodes
50
51 subseg2display: subseg2display.o
52                 $(LINK) $(NETPBM) -lpub -lm
53
54 compose-segenco: compose-segenco.o
55                 $(LINK) $(NETPBM)
56
57 %.neato.ps:     %.neato
58                 neato -Tps <$< $o
59
60 %.raw.neato:    %.redactgraph
61                 ./$< consistency printforneato $o
62
63 %.redacted.neato: %.redactgraph
64                 ./$< $(REDACT) consistency printforneato $o
65
66 %.redacted.forsafety: %.redactgraph
67                 ./$< $(REDACT) consistency printforforsafety $o
68
69 %.layout-data.c: data2safety %.wiring %.redacted.forsafety \
70                         reversers.pin-info detectors.pin-info
71                 ./$(filter-out %.pin-info, $^) $o
72
73 %+pindata.asm:  %.layout-data.c
74                 @:
75
76 %.pin-info:     pin-info-gen ../pcb/%.net
77                 ./$< $* $o
78
79 %.redactgraph:  %.graph.o redactgraph.o
80                 $(LINK)
81
82 %.d4:           %.m4 $(M4INCS) Makefile
83                 m4 -s <$< $o
84
85 %-a.ps:         %.d4 layout
86                 ./layout <$< $(LAYOUTOPTS) '-E*lD' $o
87
88 %-al.ps:        %.d4 layout
89                 ./layout <$< $(LAYOUTOPTS) '-e*C' '-ep=rm' $o
90
91 %-ap.ps:        %.d4 layout
92                 ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o
93
94 %.segcmapreq:   %.run-layout
95                 ./$< $(LAYOUTOPTS_SEGS) -GR $o
96
97 %.segcmap:      %.segcmapreq segcmapassign segcmap.h
98                 ./segcmapassign <$< $o
99
100 %.dgram.m:      %.dgram-list make-dgram-make
101                 ./make-dgram-make <$< $* $o
102
103 %.m:            %.gen-make
104                 ./$< $o
105
106 %.segenco.ppm:  %.segenco.ps Makefile
107                 gs -dNOPAUSE -dBATCH -dSAFER -q \
108                         -sDEVICE=ppmraw -r72 -g595x842 \
109                         -sOutputFile=$@.new $< && mv -f $@.new $@
110
111 ours.graph.c:   extractgraph ours.dgram-bot.p0.segenco.ps
112                 ./$^ $o
113 # Strictly, this is wrong as it only uses layer 0.  When we have more
114 # layers, should put them all in same segenco specially for extractgraph
115
116 ours-l%.ps:     ours.d4 layout
117                 ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o
118
119 ours-e%.ps:     ours.d4 layout
120                 ./layout <$< -l$* -E'=*aRsclMno' \
121                         -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o
122
123 ours-p%.ps:     ours.d4 layout
124                 ./layout <$< -l$$(printf %s "$*" | sed -e 's/-/ -P/') \
125                         $(LAYOUTOPTS_PHYS) $(XLAYOUTOPTS_LAYER) $o
126
127 parts.ps:       showlib.d4 layout
128                 ./layout <$< $(LAYOUTOPTS_ALL) $o
129
130 # test case
131 t.ppm:          ours.dgram-bot.pa.segenco.ppm x.gdb subseg2display
132                 gdb -x x.gdb
133
134 ui-plan-%.ppm:  ours.dgram-%.pa.segenco.ppm Makefile
135                 pnmcrop <$< >$@.1.new
136                 pnmflip <$@.1.new -ccw >$@.2.new
137                 pnmpad <$@.2.new -white -l5 -r5 -t5 -b5 $o
138
139 subseg2display.o compose-segenco.o: segcmap.h
140
141 clean:
142                 -rm -f -- *.d4 *~ t.* *.m *.new core
143                 -rm -f ours.*.ps ours-*.ps parts.ps *.neato.ps ours.*.neato
144                 -rm -f dualjn-*.ps
145                 -rm -f *.pin-info *+pindata.asm
146                 -rm -f *.redacted.forsafety *.redacted.forneato
147                 -rm -f *.oprint-*.ps *.run-layout
148                 -rm -f *.segcmap *.segcmapreq
149                 -rm -f *.dgram-*.p*.segenco.ps *.dgram-*.p*.segenco.ppm
150                 -rm -f *.dgram-*.plandata.c ours.graph.c ours.layout-data.c
151                 -rm -f $(CPROGS) *.o *.d ours.redactgraph
152                 -rm -f tmp.* ui-plan-*.ppm
153
154 .PRECIOUS:      $(OPRINTS)
155 .PRECIOUS:      %.segcmap %.segcmapreq %.segenco.ppm %.d4 %.neato %.raw.neato
156 .PRECIOUS:      %.redactgraph %.redacted.forsafety %.redacted.neato
157 .PRECIOUS:      %.layout-data.c %.pin-info
158
159 include $(wildcard *.d)