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