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
41 EXAMPLE_EXECS = v3_user_host_dev_example \
43 v3_user_keyed_stream_example \
44 v3_user_keyed_stream_file \
47 # Currently experimental things
49 EXPERIMENTAL_EXECS = v3_simulate \
50 v3_inject_ecc_scrubber_mce \
60 # Things that have been built elsewhere - just for reference here
62 PRECOMPILED_EXECS = x0vncserver
64 COPIED_EXECS = v3_x0vncserver v3_x0gui
67 # Libraries that we need to build
69 LIBS = libv3_user_host_dev.a libv3_user_keyed_stream.a libv3_ctrl.a libv3_guest_mem.a libv3_fb.a
71 BUILD_EXECS = $(BASE_EXECS) $(EXAMPLE_EXECS) $(EXPERIMENTAL_EXECS)
75 CFILES = $(BUILD_EXECS:%=%.c) $(BUILD_LIBS:lib%.a=%.c)
81 CFLAGS += -I../linux_module
86 all: $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
89 libv3_ctrl.a : v3_ctrl.c v3_ctrl.h
90 $(CC) $(CFLAGS) -I../linux_module -c v3_ctrl.c
91 $(AR) ruv libv3_ctrl.a v3_ctrl.o
95 # JSON library for use in some tools
97 libjson.a : cJSON.c cJSON.h
98 $(CC) $(CFLAGS) -c cJSON.c
99 $(AR) ruv libjson.a cJSON.o
102 # Most tools compile in a straightforward way
104 % :: %.c v3_ctrl.h libv3_ctrl.a
105 $(CC) $(CFLAGS) $< -lv3_ctrl -L. -o $@
109 # Console support requires curses
112 CURSES_CFLAGS = -DNCURSES_STATIC
113 CURSES_LIBS = -lcurses
116 CURSES_LIBS = -lcurses
120 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
122 v3_cons_sc: v3_cons_sc.c
123 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
125 v3_create: v3_create.c ezxml.c libv3_ctrl.a
126 $(CC) $(CFLAGS) $^ -lv3_ctrl -L. -o $@
131 # User host devices include a library and some examples
133 libv3_user_host_dev.a : v3_user_host_dev.c v3_user_host_dev.h v3_ctrl.h
134 $(CC) $(CFLAGS) -I../linux_module -c v3_user_host_dev.c
135 $(AR) ruv libv3_user_host_dev.a v3_user_host_dev.o
136 rm -f v3_user_host_dev.o
138 v3_user_host_dev_example : v3_user_host_dev_example.c libv3_user_host_dev.a
139 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
141 v3_os_debug : v3_os_debug.c libv3_user_host_dev.a
142 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
145 # Guarded module registration for GEARS
147 v3_register_gm: v3_register_gm.c libjson.a libv3_ctrl.a v3_ctrl.h
148 $(CC) $(CFLAGS) $< -L. -lm -lv3_ctrl -ljson -o $@
151 # User keyed stream support includes a library and examples
154 libv3_user_keyed_stream.a :: v3_user_keyed_stream.c v3_user_keyed_stream.h v3_ctrl.h
155 $(CC) $(CFLAGS) -I../linux_module -c v3_user_keyed_stream.c
156 $(AR) ruv libv3_user_keyed_stream.a v3_user_keyed_stream.o
157 rm -f v3_user_keyed_stream.o
160 v3_user_keyed_stream_example : v3_user_keyed_stream_example.c libv3_user_keyed_stream.a
161 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
163 v3_user_keyed_stream_file : v3_user_keyed_stream_file.c libv3_user_keyed_stream.a
164 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
167 # guest memory access by mmap and example
169 libv3_guest_mem.a : v3_guest_mem.c v3_guest_mem.h v3_ctrl.h
170 $(CC) $(CFLAGS) -c v3_guest_mem.c
171 $(AR) ruv libv3_guest_mem.a v3_guest_mem.o
174 v3_guest_mem_access : v3_guest_mem_access.c libv3_guest_mem.a
175 $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -o $@
179 # FB (Graphics Console) user interface library (needed for VNC access
180 # to GC - also wraps mouse and keyboard event delivery)
181 libv3_fb.a : v3_fb.c v3_fb.h
182 $(CC) $(CFLAGS) -I../linux_module -c v3_fb.c
183 $(AR) ruv libv3_fb.a v3_fb.o
189 # VNC support is compiled separately
192 @if [ -a x0vncserver ] ; \
194 cp x0vncserver v3_x0vncserver ; \
196 echo "In order to use v3_vncclient/server you must have" ; \
197 echo "previously built or received palacios/linux_usr/x0vncserver" ; \
198 echo "To learn more about this, look in palacios/linux_usr/vnc"; \
202 # GUI is compiled separately
205 @if [ -a gui/Palacios ] ; \
207 cp gui/Palacios v3_x0gui ; \
209 echo "In order to use v3_gui (the graphical interface)" ;\
210 echo "you must first cd to palacios/linux_usr/gui" ;\
211 echo "and compile it according to the README given there";\
215 # Cleanup and dependency builds are automated
218 rm -f $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
221 $(CC) -MM $(CFILES) -I../linux_module > .dependencies