chiark / gitweb /
hostside: include autoversion and print it in a couple of relevant places
[trains.git] / hostside / Makefile
1 #
2
3 TRAINS=         santafe shinkansen bavarian
4
5 AUTOINCS=       auproto-pic.h layoutinfo.h retransmit-table.h           \
6                 errorcodes.h stastate.h record-y.h record-l.h           \
7                 realtime+dflags.h input-codes.h
8
9 CLIENT_TARGETS= gui-plan-bot topology-dump evdev-manip
10
11 TARGETS=        adhoc-test realtime                                     \
12                 $(CLIENT_TARGETS)                                       \
13                 $(addsuffix .speeds.ps, $(TRAINS))                      \
14                 $(addsuffix .speeds.record, $(TRAINS))
15
16 INPUT_H=        /usr/include/linux/input.h
17
18 LIBOOP_OBJS=    __oop-read-copy.o -loop
19 LAYOUT_DATA=    ../layout/ours.layout-data
20
21 include ../common.make
22 include ../cprogs.make
23
24 default:        all
25 recurse:        all
26 for-pic:
27 all:            $(TARGETS)
28 client:         $(CLIENT_TARGETS)
29
30 #---------- executables ----------
31
32 adhoc-test:     serialio.o nmra.o adhoc-test.o encode.o utils.o
33                 $(LINK)
34
35 topology-dump:  topology-dump.o utils.o $(LAYOUT_DATA).o
36
37 evdev-manip:    evdev-manip.o utils.o $(LIBOOP_OBJS)
38
39 gui-plan-bot: gui-plan-%:  gui-plan.o utils.o parseutils.o obc.o        \
40                         ../layout/ours.dgram-%.plandata.o               \
41                         $(LAYOUT_DATA).o $(LIBOOP_OBJS)
42                 $(LINK) -L/usr/X11R6/lib -lXpm -lX11
43
44 #---------- realtime (executable) ----------
45
46 REALTIME_CORE=  realtime startup safety trackloc                \
47                 speed actual retransmit persist resolve         \
48                 cmdinput commands obc eventhelp simulate        \
49                 record record-l record-y                        \
50                 utils serialio parseutils auproto-pic           \
51                 nmra encode movpos rtprio                       \
52                 $(LAYOUT_DATA)
53
54 REALTIME_CORE_OBJS= $(addsuffix .o, $(REALTIME_CORE))
55
56 realtime:       $(REALTIME_CORE_OBJS) $(LIBOOP_OBJS) -lm
57                 ../.git-revid C >$@+autoversion.c.new
58                 @set -x; if ! cmp $@+autoversion.c.new $@+autoversion.c; then \
59                         mv $@+autoversion.c.new $@+autoversion.c; \
60                         $(CC) $(CFLAGS) -c $@+autoversion.c; \
61                 fi
62                 $(CC) $(LDFLAGS) $@+autoversion.o $^ $(LDLIBS) -o $@
63
64 #---------- other targets ----------
65
66 %.speeds.ps %.speeds.record: ./analyse-speeds \
67         ../layout/ours.redacted.shellvars %.manual
68                 ./$< $*
69
70 #---------- autogenerated input files ----------
71
72 proto-expanded: ../cebpic/README.protocol
73                 expand <$< $o
74
75 auproto-pic.c auproto-pic.h: auproto-%: \
76                         parse-proto-spec proto-expanded skelproto-%
77                 ./$+ $o
78
79 record-y.h: record-y.c
80 record-l.h: record-l.c
81
82 layoutinfo.h:   ../layout/ours.layout-data.c Makefile
83                 sed -e '/^#include/,$$d' $< $(ocmp)
84
85 retransmit-table.h errorcodes.h stastate.h: %: %.gen
86                 (echo "/*autogenerated*/" && ./$<) $o
87
88 realtime+dflags.h: debug-extractor $(addsuffix .c, $(REALTIME_CORE))
89                 ./$^ $(ocmp)
90
91 input-codes.h:  extract-input-codes $(INPUT_H)
92                 ./$^ $o
93
94 %:              %.gen
95                 ./$^ $o
96
97 #---------- administrative pseudo targets ----------
98
99 tidy:
100                 rm -rf ./+dump.* ./+persist.* ./+realtime.log
101
102 clean:
103                 rm -f *.o *.d t u v $(TARGETS) $(AUTOINCS)
104                 rm -f auproto-pic.[ch] *~ .*~ core proto-expanded
105                 rm -f record-[yl].[ch] *.tmp *.new
106
107 realclean:      clean tidy
108
109 #---------- installing things as root bessar ----------
110
111 BESSAR_PROGRAMS=        evdev-manip eventrun
112 BESSAR_ETC_FILES=       bessar-root.eventrun evdev-manip-bessar
113
114 install-bessar-root:    $(BESSAR_PROGRAMS) $(BESSAR_ETC_FILES)
115         rsync -vP $(BESSAR_PROGRAMS) davenant:/usr/local/bin/
116         rsync -vP $(BESSAR_ETC_FILES) davenant:/u/ian/things/Bessar/etc/
117
118 #---------- copying things to bessar (obsolete?) ----------
119
120 BESSAR=bessar:things/trains-bessar/hostside/.
121
122 SPECIAL_CFLAGS_record-l= $(FLEXCFLAGS)
123
124 on-bessar:      $(TARGETS)
125                 RSYNC_RSH=fsh rsync $(TARGETS) $(BESSAR)
126
127 %.on-bessar:    %
128                 RSYNC_RSH=fsh rsync $^ $(BESSAR)
129
130
131 include $(wildcard *.d)