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