Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Linux user updates for more recent distros (Ubuntu 14.04 as target)
[palacios.git] / linux_usr / Makefile
1 #
2 # Build Static or Dynamic versions of the control utilities
3 #
4 #
5
6 # define this at the command-line or here
7 # to get dynamically linked versions
8 STATIC = 0
9
10 #
11 # Executables that implement core functionality
12 #
13 BASE_EXECS =    v3_mem \
14                 v3_mem_reset \
15                 v3_create \
16                 v3_create_bind \
17                 v3_free  \
18                 v3_launch \
19                 v3_reset  \
20                 v3_stop   \
21                 v3_pause  \
22                 v3_continue \
23                 v3_core_move \
24                 v3_mem_move \
25                 v3_load \
26                 v3_save \
27                 v3_cons \
28                 v3_cons_sc \
29                 v3_stream \
30                 v3_monitor \
31                 v3_hypercall \
32                 v3_debug \
33                 v3_send \
34                 v3_receive \
35                 v3_pci \
36                 v3_guest_mem_access \
37                 v3_guest_mem_track \
38                 v3_dvfs
39
40
41 #
42 # Examples
43 #
44 EXAMPLE_EXECS = v3_user_host_dev_example \
45                 v3_os_debug \
46                 v3_user_keyed_stream_example \
47                 v3_user_keyed_stream_file \
48
49 #
50 # Currently experimental things
51 #
52 EXPERIMENTAL_EXECS =    v3_simulate  \
53                         v3_inject_ecc_scrubber_mce  \
54                         v3_top_inject \
55                         v3_env_inject \
56                         v3_syscall \
57                         v3_register_gm \
58                         v3_devfile_shadow
59
60
61
62
63 #
64 # Things that have been built elsewhere - just for reference here
65 #
66 PRECOMPILED_EXECS = x0vncserver
67
68 COPIED_EXECS = v3_x0vncserver v3_x0gui
69
70 #
71 # Libraries that we need to build
72 #
73 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
74
75 BUILD_EXECS = $(BASE_EXECS) $(EXAMPLE_EXECS) $(EXPERIMENTAL_EXECS) 
76 BUILD_LIBS = $(LIBS)
77
78
79 CFILES = $(BUILD_EXECS:%=%.c) $(BUILD_LIBS:lib%.a=%.c) 
80
81 ifeq ($(STATIC),1)
82   CFLAGS += -static 
83 endif
84
85 CFLAGS += -I../linux_module -I../palacios/include/
86
87 CC = gcc -g
88 AR = ar
89
90 all: $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
91
92
93 libv3_ctrl.a : v3_ctrl.c v3_ctrl.h
94         $(CC) $(CFLAGS) -I../linux_module -c v3_ctrl.c
95         $(AR) ruv libv3_ctrl.a v3_ctrl.o
96         rm -rf v3_ctrl.o 
97
98 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 
99         $(CC) $(CFLAGS) -I../linux_module -fPIC -c v3_io_chan.c
100         $(CC) $(CFLAGS) -I../linux_module -fPIC -c v3_user_host_dev.c
101         $(CC) -shared -o $@ v3_io_chan.o v3_user_host_dev.o
102         -echo "Attempting install into system paths"
103         -cp $@ /usr/lib64/
104         -cp v3_io_chan.h /usr/include/
105 #
106 # JSON library for use in some tools
107 #
108 libjson.a : cJSON.c cJSON.h
109         $(CC) $(CFLAGS) -c cJSON.c
110         $(AR) ruv libjson.a cJSON.o
111         rm -rf cJSON.o
112 #
113 # Most tools compile in a straightforward way
114 #
115 % :: %.c v3_ctrl.h libv3_ctrl.a
116         $(CC) $(CFLAGS) $< -lv3_ctrl -L. -o $@
117
118
119 #
120 # Console support requires curses
121 #
122 ifeq ($(STATIC),1)
123   CURSES_CFLAGS = -DNCURSES_STATIC
124   CURSES_LIBS = -lcurses                           
125 else
126   CURSES_CFLAGS = 
127   CURSES_LIBS = -lcurses 
128 endif
129
130 v3_cons: v3_cons.c
131         $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
132
133 v3_cons_sc: v3_cons_sc.c
134         $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
135
136 v3_create: v3_create.c ezxml.c libv3_ctrl.a 
137         $(CC) $(CFLAGS) $^ -lv3_ctrl -L. -o $@
138
139
140
141 #
142 # User host devices include a library and some examples
143 #
144 libv3_user_host_dev.a : v3_user_host_dev.c v3_user_host_dev.h v3_ctrl.h
145         $(CC) $(CFLAGS) -I../linux_module -c v3_user_host_dev.c 
146         $(AR) ruv libv3_user_host_dev.a v3_user_host_dev.o
147         rm -f v3_user_host_dev.o
148
149 v3_user_host_dev_example : v3_user_host_dev_example.c libv3_user_host_dev.a
150         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
151
152 v3_os_debug : v3_os_debug.c libv3_user_host_dev.a
153         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
154
155 #
156 # Guarded module registration for GEARS
157 #
158 v3_register_gm: v3_register_gm.c libjson.a libv3_ctrl.a v3_ctrl.h
159         $(CC) $(CFLAGS) $< -L. -lv3_ctrl -ljson -lm -o $@
160
161 #
162 # User keyed stream support includes a library and examples
163 #
164 #
165 libv3_user_keyed_stream.a :: v3_user_keyed_stream.c v3_user_keyed_stream.h v3_ctrl.h
166         $(CC) $(CFLAGS) -I../linux_module -c v3_user_keyed_stream.c 
167         $(AR) ruv libv3_user_keyed_stream.a v3_user_keyed_stream.o
168         rm -f v3_user_keyed_stream.o
169
170
171 v3_user_keyed_stream_example : v3_user_keyed_stream_example.c libv3_user_keyed_stream.a
172         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
173
174 v3_user_keyed_stream_file : v3_user_keyed_stream_file.c libv3_user_keyed_stream.a
175         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
176
177
178 # guest memory access by mmap 
179 # guest memory reference tracking via mem_track interface
180 # examples
181 #
182 libv3_guest_mem.a : v3_guest_mem.c v3_guest_mem.h v3_ctrl.h
183         $(CC) $(CFLAGS) -c v3_guest_mem.c 
184         $(AR) ruv libv3_guest_mem.a v3_guest_mem.o
185         rm -f v3_guest_mem.o
186
187 v3_guest_mem_access : v3_guest_mem_access.c libv3_guest_mem.a libv3_ctrl.a
188         $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -lv3_ctrl -o $@
189
190 v3_guest_mem_track : v3_guest_mem_track.c libv3_guest_mem.a libv3_ctrl.a
191         $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -lv3_ctrl -o $@
192
193
194 # Use this for shadow process
195 v3_devfile_shadow : v3_devfile_shadow.c libv3_guest_mem.a libv3_ctrl.a
196         $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -lv3_ctrl -o $@
197
198 #
199 # User DVFS control includse a library and a caller
200 #
201 libv3_user_dvfs.a : v3_user_dvfs.c v3_user_dvfs.h v3_ctrl.h
202         $(CC) $(CFLAGS) -I../linux_module -c v3_user_dvfs.c 
203         $(AR) ruv libv3_user_dvfs.a v3_user_dvfs.o
204         rm -f v3_user_dvfs.o
205
206 v3_dvfs : v3_dvfs.c libv3_user_dvfs.a libv3_ctrl.a
207         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_dvfs -lv3_ctrl -o $@
208
209
210 #
211 # FB (Graphics Console) user interface library (needed for VNC access
212 #  to GC - also wraps mouse and keyboard event delivery)
213 libv3_fb.a : v3_fb.c v3_fb.h
214         $(CC) $(CFLAGS) -I../linux_module -c v3_fb.c
215         $(AR) ruv libv3_fb.a v3_fb.o
216         rm -rf v3_fb.o 
217
218
219
220 #
221 # VNC support is compiled separately
222 #
223 v3_x0vncserver : 
224         @if [ -e x0vncserver ] ; \
225         then \
226                 cp x0vncserver v3_x0vncserver ; \
227         else \
228                 echo "In order to use v3_vncclient/server you must have" ; \
229                 echo "previously built or received palacios/linux_usr/x0vncserver" ; \
230                 echo "To learn more about this, look in palacios/linux_usr/vnc"; \
231         fi;
232
233 #
234 # GUI is compiled separately
235 #
236 v3_x0gui : 
237         @if [ -e gui/Palacios ] ; \
238         then \
239                 cp gui/Palacios v3_x0gui ; \
240         else \
241                 echo "In order to use v3_gui (the graphical interface)" ;\
242                 echo "you must first cd to palacios/linux_usr/gui" ;\
243                 echo "and compile it according to the README given there";\
244         fi;
245
246 #
247 # Cleanup and dependency builds are automated
248 #
249 clean:
250         rm -f $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
251
252 depend:
253         $(CC) -MM $(CFILES) -I../linux_module > .dependencies
254