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