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.


Add guarded module infrastructure
[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_free \
15                 v3_create \
16                 v3_create_bind \
17                 v3_free  \
18                 v3_launch \
19                 v3_stop   \
20                 v3_pause  \
21                 v3_continue \
22                 v3_core_move \
23                 v3_load \
24                 v3_save \
25                 v3_cons \
26                 v3_cons_sc \
27                 v3_stream \
28                 v3_monitor \
29                 v3_hypercall \
30                 v3_debug \
31                 v3_send \
32                 v3_receive \
33                 v3_pci
34
35
36 #
37 # Examples
38 #
39 EXAMPLE_EXECS = v3_user_host_dev_example \
40                 v3_os_debug \
41                 v3_user_keyed_stream_example \
42                 v3_user_keyed_stream_file \
43                 v3_guest_mem_example
44
45 #
46 # Currently experimental things
47 #
48 EXPERIMENTAL_EXECS =    v3_simulate  \
49                         v3_inject_ecc_scrubber_mce  \
50                         v3_top_inject \
51                         v3_env_inject \
52                         v3_syscall \
53                         v3_register_gm
54
55
56
57
58 #
59 # Things that have been built elsewhere - just for reference here
60 #
61 PRECOMPILED_EXECS = x0vncserver
62
63 COPIED_EXECS = v3_x0vncserver v3_x0gui
64
65 #
66 # Libraries that we need to build
67 #
68 LIBS = libv3_user_host_dev.a libv3_user_keyed_stream.a libv3_ctrl.a libv3_guest_mem.a libv3_fb.a
69
70 BUILD_EXECS = $(BASE_EXECS) $(EXAMPLE_EXECS) $(EXPERIMENTAL_EXECS) 
71 BUILD_LIBS = $(LIBS)
72
73
74 CFILES = $(BUILD_EXECS:%=%.c) $(BUILD_LIBS:lib%.a=%.c) 
75
76 ifeq ($(STATIC),1)
77   CFLAGS += -static 
78 endif
79
80 CFLAGS += -I../linux_module
81
82 CC = gcc
83 AR = ar
84
85 all: $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
86
87
88 libv3_ctrl.a : v3_ctrl.c v3_ctrl.h
89         $(CC) $(CFLAGS) -I../linux_module -c v3_ctrl.c
90         $(AR) ruv libv3_ctrl.a v3_ctrl.o
91         rm -rf v3_ctrl.o 
92
93 libjson.a : cJSON.c cJSON.h
94         $(CC) $(CFLAGS) -c cJSON.c
95         $(AR) ruv libjson.a cJSON.o
96         rm -rf cJSON.o
97 #
98 # Most tools compile in a straightforward way
99 #
100 % :: %.c v3_ctrl.h libv3_ctrl.a
101         $(CC) $(CFLAGS) $< -lv3_ctrl -L. -o $@
102
103
104 #
105 # Console support requires curses
106 #
107 ifeq ($(STATIC),1)
108   CURSES_CFLAGS = -DNCURSES_STATIC
109   CURSES_LIBS = -lcurses                           
110 else
111   CURSES_CFLAGS = 
112   CURSES_LIBS = -lcurses 
113 endif
114
115 v3_cons: v3_cons.c
116         $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
117
118 v3_cons_sc: v3_cons_sc.c
119         $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
120
121 v3_create: v3_create.c ezxml.c libv3_ctrl.a 
122         $(CC) $(CFLAGS) $^ -lv3_ctrl -L. -o $@
123
124
125
126 #
127 # User host devices include a library and some examples
128 #
129 libv3_user_host_dev.a : v3_user_host_dev.c v3_user_host_dev.h v3_ctrl.h
130         $(CC) $(CFLAGS) -I../linux_module -c v3_user_host_dev.c 
131         $(AR) ruv libv3_user_host_dev.a v3_user_host_dev.o
132         rm -f v3_user_host_dev.o
133
134 v3_user_host_dev_example : v3_user_host_dev_example.c libv3_user_host_dev.a
135         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
136
137 v3_os_debug : v3_os_debug.c libv3_user_host_dev.a
138         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_host_dev -o $@
139
140 v3_register_gm: v3_register_gm.c libjson.a libv3_ctrl.a v3_ctrl.h
141         $(CC) $(CFLAGS) $< -L. -lm -lv3_ctrl -ljson -o $@
142
143 #
144 # User keyed stream support includes a library and examples
145 #
146 #
147 libv3_user_keyed_stream.a :: v3_user_keyed_stream.c v3_user_keyed_stream.h v3_ctrl.h
148         $(CC) $(CFLAGS) -I../linux_module -c v3_user_keyed_stream.c 
149         $(AR) ruv libv3_user_keyed_stream.a v3_user_keyed_stream.o
150         rm -f v3_user_keyed_stream.o
151
152
153 v3_user_keyed_stream_example : v3_user_keyed_stream_example.c libv3_user_keyed_stream.a
154         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
155
156 v3_user_keyed_stream_file : v3_user_keyed_stream_file.c libv3_user_keyed_stream.a
157         $(CC) $(CFLAGS) $< -I../linux_module -L. -lv3_user_keyed_stream -o $@
158
159
160 # guest memory access by mmap and example
161 #
162 libv3_guest_mem.a : v3_guest_mem.c v3_guest_mem.h v3_ctrl.h
163         $(CC) $(CFLAGS) -c v3_guest_mem.c 
164         $(AR) ruv libv3_guest_mem.a v3_guest_mem.o
165         rm -f v3_guest_mem.o
166
167 v3_guest_mem_example : v3_guest_mem_example.c libv3_guest_mem.a
168         $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -o $@
169
170
171 #
172 # FB (Graphics Console) user interface library (needed for VNC access
173 #  to GC - also wraps mouse and keyboard event delivery)
174 libv3_fb.a : v3_fb.c v3_fb.h
175         $(CC) $(CFLAGS) -I../linux_module -c v3_fb.c
176         $(AR) ruv libv3_fb.a v3_fb.o
177         rm -rf v3_fb.o 
178
179
180
181 #
182 # VNC support is compiled separately
183 #
184 v3_x0vncserver : 
185         @if [ -a x0vncserver ] ; \
186         then \
187                 cp x0vncserver v3_x0vncserver ; \
188         else \
189                 echo "In order to use v3_vncclient/server you must have" ; \
190                 echo "previously built or received palacios/linux_usr/x0vncserver" ; \
191                 echo "To learn more about this, look in palacios/linux_usr/vnc"; \
192         fi;
193
194 #
195 # GUI is compiled separately
196 #
197 v3_x0gui : 
198         @if [ -a gui/Palacios ] ; \
199         then \
200                 cp gui/Palacios v3_x0gui ; \
201         else \
202                 echo "In order to use v3_gui (the graphical interface)" ;\
203                 echo "you must first cd to palacios/linux_usr/gui" ;\
204                 echo "and compile it according to the README given there";\
205         fi;
206
207 #
208 # Cleanup and dependency builds are automated
209 #
210 clean:
211         rm -f $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
212
213 depend:
214         $(CC) -MM $(CFILES) -I../linux_module > .dependencies
215