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
39 EXAMPLE_EXECS = v3_user_host_dev_example \
41 v3_user_keyed_stream_example \
42 v3_user_keyed_stream_file \
46 # Currently experimental things
48 EXPERIMENTAL_EXECS = v3_simulate \
49 v3_inject_ecc_scrubber_mce \
58 # Things that have been built elsewhere - just for reference here
60 PRECOMPILED_EXECS = x0vncserver
62 COPIED_EXECS = v3_x0vncserver v3_x0gui
65 # Libraries that we need to build
67 LIBS = libv3_user_host_dev.a libv3_user_keyed_stream.a libv3_ctrl.a libv3_guest_mem.a libv3_fb.a
69 BUILD_EXECS = $(BASE_EXECS) $(EXAMPLE_EXECS) $(EXPERIMENTAL_EXECS)
73 CFILES = $(BUILD_EXECS:%=%.c) $(BUILD_LIBS:lib%.a=%.c)
79 CFLAGS += -I../linux_module
84 all: $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
87 libv3_ctrl.a : v3_ctrl.c v3_ctrl.h
88 $(CC) $(CFLAGS) -I../linux_module -c v3_ctrl.c
89 $(AR) ruv libv3_ctrl.a v3_ctrl.o
93 # Most tools compile in a straightforward way
95 % :: %.c v3_ctrl.h libv3_ctrl.a
96 $(CC) $(CFLAGS) $< -lv3_ctrl -L. -o $@
100 # Console support requires curses
103 CURSES_CFLAGS = -DNCURSES_STATIC
104 CURSES_LIBS = -lcurses
107 CURSES_LIBS = -lcurses
111 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
113 v3_cons_sc: v3_cons_sc.c
114 $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
116 v3_create: v3_create.c ezxml.c libv3_ctrl.a
117 $(CC) $(CFLAGS) $^ -lv3_ctrl -L. -o $@
122 # User host devices include a library and some examples
124 libv3_user_host_dev.a : v3_user_host_dev.c v3_user_host_dev.h v3_ctrl.h
125 $(CC) $(CFLAGS) -I../linux_module -c v3_user_host_dev.c
126 $(AR) ruv libv3_user_host_dev.a v3_user_host_dev.o
127 rm -f v3_user_host_dev.o
129 v3_user_host_dev_example : v3_user_host_dev_example.c libv3_user_host_dev.a
130 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
132 v3_os_debug : v3_os_debug.c libv3_user_host_dev.a
133 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
137 # User keyed stream support includes a library and examples
140 libv3_user_keyed_stream.a :: v3_user_keyed_stream.c v3_user_keyed_stream.h v3_ctrl.h
141 $(CC) $(CFLAGS) -I../linux_module -c v3_user_keyed_stream.c
142 $(AR) ruv libv3_user_keyed_stream.a v3_user_keyed_stream.o
143 rm -f v3_user_keyed_stream.o
146 v3_user_keyed_stream_example : v3_user_keyed_stream_example.c libv3_user_keyed_stream.a
147 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
149 v3_user_keyed_stream_file : v3_user_keyed_stream_file.c libv3_user_keyed_stream.a
150 $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
153 # guest memory access by mmap and example
155 libv3_guest_mem.a : v3_guest_mem.c v3_guest_mem.h v3_ctrl.h
156 $(CC) $(CFLAGS) -c v3_guest_mem.c
157 $(AR) ruv libv3_guest_mem.a v3_guest_mem.o
160 v3_guest_mem_example : v3_guest_mem_example.c libv3_guest_mem.a
161 $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -o $@
165 # FB (Graphics Console) user interface library (needed for VNC access
166 # to GC - also wraps mouse and keyboard event delivery)
167 libv3_fb.a : v3_fb.c v3_fb.h
168 $(CC) $(CFLAGS) -I../linux_module -c v3_fb.c
169 $(AR) ruv libv3_fb.a v3_fb.o
175 # VNC support is compiled separately
178 @if [ -a x0vncserver ] ; \
180 cp x0vncserver v3_x0vncserver ; \
182 echo "In order to use v3_vncclient/server you must have" ; \
183 echo "previously built or received palacios/linux_usr/x0vncserver" ; \
184 echo "To learn more about this, look in palacios/linux_usr/vnc"; \
188 # GUI is compiled separately
191 @if [ -a gui/Palacios ] ; \
193 cp gui/Palacios v3_x0gui ; \
195 echo "In order to use v3_gui (the graphical interface)" ;\
196 echo "you must first cd to palacios/linux_usr/gui" ;\
197 echo "and compile it according to the README given there";\
201 # Cleanup and dependency builds are automated
204 rm -f $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
207 $(CC) -MM $(CFILES) -I../linux_module > .dependencies