2 # Build Static or Dynamic versions of the control utilities
6 # define this at the command-line or here
7 # to get dynamically linked versions
11 # Executables that implement core functionality
44 EXAMPLE_EXECS = v3_user_host_dev_example \
46 v3_user_keyed_stream_example \
47 v3_user_keyed_stream_file \
50 # Currently experimental things
52 EXPERIMENTAL_EXECS = v3_simulate \
53 v3_inject_ecc_scrubber_mce \
60 NONDEFAULT_EXECS = v3_cons_tc # needs to have termkey installed
66 # Things that have been built elsewhere - just for reference here
68 PRECOMPILED_EXECS = x0vncserver
70 COPIED_EXECS = v3_x0vncserver v3_x0gui
73 # Libraries that we need to build
75 LIBS = libv3_user_host_dev.a libv3_user_keyed_stream.a libv3_ctrl.a libv3_guest_mem.a libv3_fb.a libv3_user_dvfs.a libv3_io_chan.so
77 BUILD_EXECS = $(BASE_EXECS) $(EXAMPLE_EXECS) $(EXPERIMENTAL_EXECS)
81 CFILES = $(BUILD_EXECS:%=%.c) $(BUILD_LIBS:lib%.a=%.c)
87 CFLAGS += -I../linux_module -I../palacios/include/
92 all: $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
95 libv3_ctrl.a : v3_ctrl.c v3_ctrl.h
96 $(CC) $(CFLAGS) -I../linux_module -c v3_ctrl.c
97 $(AR) ruv libv3_ctrl.a v3_ctrl.o
100 libv3_io_chan.so: v3_io_chan.c v3_io_chan.h v3_user_host_dev.c v3_user_host_dev.h ../linux_module/iface-host-dev.h
101 $(CC) $(CFLAGS) -I../linux_module -fPIC -c v3_io_chan.c
102 $(CC) $(CFLAGS) -I../linux_module -fPIC -c v3_user_host_dev.c
103 $(CC) -shared -o $@ v3_io_chan.o v3_user_host_dev.o
104 -echo "Attempting install into system paths"
106 -cp v3_io_chan.h /usr/include/
108 # JSON library for use in some tools
110 libjson.a : cJSON.c cJSON.h
111 $(CC) $(CFLAGS) -c cJSON.c
112 $(AR) ruv libjson.a cJSON.o
115 # Most tools compile in a straightforward way
117 % :: %.c v3_ctrl.h libv3_ctrl.a
118 $(CC) $(CFLAGS) $< -lv3_ctrl -L. -o $@
122 # Console support requires curses
125 CURSES_CFLAGS = -DNCURSES_STATIC
126 CURSES_LIBS = -lcurses
129 CURSES_LIBS = -lcurses
133 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
135 v3_cons_sc: v3_cons_sc.c
136 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
138 v3_cons_tc: v3_cons_tc.c
139 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -L. -ltermkey -lcurses -o $@
142 v3_create: v3_create.c ezxml.c libv3_ctrl.a
143 $(CC) $(CFLAGS) $^ -lv3_ctrl -L. -o $@
148 # User host devices include a library and some examples
150 libv3_user_host_dev.a : v3_user_host_dev.c v3_user_host_dev.h v3_ctrl.h
151 $(CC) $(CFLAGS) -I../linux_module -c v3_user_host_dev.c
152 $(AR) ruv libv3_user_host_dev.a v3_user_host_dev.o
153 rm -f v3_user_host_dev.o
155 v3_user_host_dev_example : v3_user_host_dev_example.c libv3_user_host_dev.a
156 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
158 v3_os_debug : v3_os_debug.c libv3_user_host_dev.a
159 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
162 # Guarded module registration for GEARS
164 v3_register_gm: v3_register_gm.c libjson.a libv3_ctrl.a v3_ctrl.h
165 $(CC) $(CFLAGS) $< -L. -lv3_ctrl -ljson -lm -o $@
168 # User keyed stream support includes a library and examples
171 libv3_user_keyed_stream.a :: v3_user_keyed_stream.c v3_user_keyed_stream.h v3_ctrl.h
172 $(CC) $(CFLAGS) -I../linux_module -c v3_user_keyed_stream.c
173 $(AR) ruv libv3_user_keyed_stream.a v3_user_keyed_stream.o
174 rm -f v3_user_keyed_stream.o
177 v3_user_keyed_stream_example : v3_user_keyed_stream_example.c libv3_user_keyed_stream.a
178 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
180 v3_user_keyed_stream_file : v3_user_keyed_stream_file.c libv3_user_keyed_stream.a
181 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
184 # guest memory access by mmap
185 # guest memory reference tracking via mem_track interface
188 libv3_guest_mem.a : v3_guest_mem.c v3_guest_mem.h v3_ctrl.h
189 $(CC) $(CFLAGS) -c v3_guest_mem.c
190 $(AR) ruv libv3_guest_mem.a v3_guest_mem.o
193 v3_guest_mem_access : v3_guest_mem_access.c libv3_guest_mem.a libv3_ctrl.a
194 $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -lv3_ctrl -o $@
196 v3_guest_mem_track : v3_guest_mem_track.c libv3_guest_mem.a libv3_ctrl.a
197 $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -lv3_ctrl -o $@
200 # Use this for shadow process
201 v3_devfile_shadow : v3_devfile_shadow.c libv3_guest_mem.a libv3_ctrl.a
202 $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -lv3_ctrl -o $@
205 # User DVFS control includse a library and a caller
207 libv3_user_dvfs.a : v3_user_dvfs.c v3_user_dvfs.h v3_ctrl.h
208 $(CC) $(CFLAGS) -I../linux_module -c v3_user_dvfs.c
209 $(AR) ruv libv3_user_dvfs.a v3_user_dvfs.o
212 v3_dvfs : v3_dvfs.c libv3_user_dvfs.a libv3_ctrl.a
213 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_dvfs -lv3_ctrl -o $@
217 # FB (Graphics Console) user interface library (needed for VNC access
218 # to GC - also wraps mouse and keyboard event delivery)
219 libv3_fb.a : v3_fb.c v3_fb.h
220 $(CC) $(CFLAGS) -I../linux_module -c v3_fb.c
221 $(AR) ruv libv3_fb.a v3_fb.o
227 # VNC support is compiled separately
230 @if [ -e x0vncserver ] ; \
232 cp x0vncserver v3_x0vncserver ; \
234 echo "In order to use v3_vncclient/server you must have" ; \
235 echo "previously built or received palacios/linux_usr/x0vncserver" ; \
236 echo "To learn more about this, look in palacios/linux_usr/vnc"; \
240 # GUI is compiled separately
243 @if [ -e gui/Palacios ] ; \
245 cp gui/Palacios v3_x0gui ; \
247 echo "In order to use v3_gui (the graphical interface)" ;\
248 echo "you must first cd to palacios/linux_usr/gui" ;\
249 echo "and compile it according to the README given there";\
253 # Cleanup and dependency builds are automated
256 rm -f $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
259 $(CC) -MM $(CFILES) -I../linux_module > .dependencies