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