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
42 EXAMPLE_EXECS = v3_user_host_dev_example \
44 v3_user_keyed_stream_example \
45 v3_user_keyed_stream_file \
48 # Currently experimental things
50 EXPERIMENTAL_EXECS = v3_simulate \
51 v3_inject_ecc_scrubber_mce \
61 # Things that have been built elsewhere - just for reference here
63 PRECOMPILED_EXECS = x0vncserver
65 COPIED_EXECS = v3_x0vncserver v3_x0gui
68 # Libraries that we need to build
70 LIBS = libv3_user_host_dev.a libv3_user_keyed_stream.a libv3_ctrl.a libv3_guest_mem.a libv3_fb.a
72 BUILD_EXECS = $(BASE_EXECS) $(EXAMPLE_EXECS) $(EXPERIMENTAL_EXECS)
76 CFILES = $(BUILD_EXECS:%=%.c) $(BUILD_LIBS:lib%.a=%.c)
82 CFLAGS += -I../linux_module -I../palacios/include/
87 all: $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
90 libv3_ctrl.a : v3_ctrl.c v3_ctrl.h
91 $(CC) $(CFLAGS) -I../linux_module -c v3_ctrl.c
92 $(AR) ruv libv3_ctrl.a v3_ctrl.o
96 # JSON library for use in some tools
98 libjson.a : cJSON.c cJSON.h
99 $(CC) $(CFLAGS) -c cJSON.c
100 $(AR) ruv libjson.a cJSON.o
103 # Most tools compile in a straightforward way
105 % :: %.c v3_ctrl.h libv3_ctrl.a
106 $(CC) $(CFLAGS) $< -lv3_ctrl -L. -o $@
110 # Console support requires curses
113 CURSES_CFLAGS = -DNCURSES_STATIC
114 CURSES_LIBS = -lcurses
117 CURSES_LIBS = -lcurses
121 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
123 v3_cons_sc: v3_cons_sc.c
124 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
126 v3_create: v3_create.c ezxml.c libv3_ctrl.a
127 $(CC) $(CFLAGS) $^ -lv3_ctrl -L. -o $@
132 # User host devices include a library and some examples
134 libv3_user_host_dev.a : v3_user_host_dev.c v3_user_host_dev.h v3_ctrl.h
135 $(CC) $(CFLAGS) -I../linux_module -c v3_user_host_dev.c
136 $(AR) ruv libv3_user_host_dev.a v3_user_host_dev.o
137 rm -f v3_user_host_dev.o
139 v3_user_host_dev_example : v3_user_host_dev_example.c libv3_user_host_dev.a
140 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
142 v3_os_debug : v3_os_debug.c libv3_user_host_dev.a
143 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
146 # Guarded module registration for GEARS
148 v3_register_gm: v3_register_gm.c libjson.a libv3_ctrl.a v3_ctrl.h
149 $(CC) $(CFLAGS) $< -L. -lm -lv3_ctrl -ljson -o $@
152 # User keyed stream support includes a library and examples
155 libv3_user_keyed_stream.a :: v3_user_keyed_stream.c v3_user_keyed_stream.h v3_ctrl.h
156 $(CC) $(CFLAGS) -I../linux_module -c v3_user_keyed_stream.c
157 $(AR) ruv libv3_user_keyed_stream.a v3_user_keyed_stream.o
158 rm -f v3_user_keyed_stream.o
161 v3_user_keyed_stream_example : v3_user_keyed_stream_example.c libv3_user_keyed_stream.a
162 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
164 v3_user_keyed_stream_file : v3_user_keyed_stream_file.c libv3_user_keyed_stream.a
165 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
168 # guest memory access by mmap
169 # guest memory reference tracking via mem_track interface
172 libv3_guest_mem.a : v3_guest_mem.c v3_guest_mem.h v3_ctrl.h
173 $(CC) $(CFLAGS) -c v3_guest_mem.c
174 $(AR) ruv libv3_guest_mem.a v3_guest_mem.o
177 v3_guest_mem_access : v3_guest_mem_access.c libv3_guest_mem.a libv3_ctrl.a
178 $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -lv3_ctrl -o $@
180 v3_guest_mem_track : v3_guest_mem_track.c libv3_guest_mem.a libv3_ctrl.a
181 $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -lv3_ctrl -o $@
185 # FB (Graphics Console) user interface library (needed for VNC access
186 # to GC - also wraps mouse and keyboard event delivery)
187 libv3_fb.a : v3_fb.c v3_fb.h
188 $(CC) $(CFLAGS) -I../linux_module -c v3_fb.c
189 $(AR) ruv libv3_fb.a v3_fb.o
195 # VNC support is compiled separately
198 @if [ -a x0vncserver ] ; \
200 cp x0vncserver v3_x0vncserver ; \
202 echo "In order to use v3_vncclient/server you must have" ; \
203 echo "previously built or received palacios/linux_usr/x0vncserver" ; \
204 echo "To learn more about this, look in palacios/linux_usr/vnc"; \
208 # GUI is compiled separately
211 @if [ -a gui/Palacios ] ; \
213 cp gui/Palacios v3_x0gui ; \
215 echo "In order to use v3_gui (the graphical interface)" ;\
216 echo "you must first cd to palacios/linux_usr/gui" ;\
217 echo "and compile it according to the README given there";\
221 # Cleanup and dependency builds are automated
224 rm -f $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
227 $(CC) -MM $(CFILES) -I../linux_module > .dependencies