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.


51fcc74ff7442d66f40321574b6c2dbef5f74958
[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_stop   \
20                 v3_pause  \
21                 v3_continue \
22                 v3_core_move \
23                 v3_mem_move \
24                 v3_load \
25                 v3_save \
26                 v3_cons \
27                 v3_cons_sc \
28                 v3_stream \
29                 v3_monitor \
30                 v3_hypercall \
31                 v3_debug \
32                 v3_send \
33                 v3_receive \
34                 v3_pci \
35                 v3_guest_mem_access
36
37
38 #
39 # Examples
40 #
41 EXAMPLE_EXECS = v3_user_host_dev_example \
42                 v3_os_debug \
43                 v3_user_keyed_stream_example \
44                 v3_user_keyed_stream_file \
45
46 #
47 # Currently experimental things
48 #
49 EXPERIMENTAL_EXECS =    v3_simulate  \
50                         v3_inject_ecc_scrubber_mce  \
51                         v3_top_inject \
52                         v3_env_inject \
53                         v3_syscall \
54                         v3_register_gm
55
56
57
58
59 #
60 # Things that have been built elsewhere - just for reference here
61 #
62 PRECOMPILED_EXECS = x0vncserver
63
64 COPIED_EXECS = v3_x0vncserver v3_x0gui
65
66 #
67 # Libraries that we need to build
68 #
69 LIBS = libv3_user_host_dev.a libv3_user_keyed_stream.a libv3_ctrl.a libv3_guest_mem.a libv3_fb.a
70
71 BUILD_EXECS = $(BASE_EXECS) $(EXAMPLE_EXECS) $(EXPERIMENTAL_EXECS) 
72 BUILD_LIBS = $(LIBS)
73
74
75 CFILES = $(BUILD_EXECS:%=%.c) $(BUILD_LIBS:lib%.a=%.c) 
76
77 ifeq ($(STATIC),1)
78   CFLAGS += -static 
79 endif
80
81 CFLAGS += -I../linux_module
82
83 CC = gcc -g
84 AR = ar
85
86 all: $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
87
88
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
92         rm -rf v3_ctrl.o 
93
94 #
95 # JSON library for use in some tools
96 #
97 libjson.a : cJSON.c cJSON.h
98         $(CC) $(CFLAGS) -c cJSON.c
99         $(AR) ruv libjson.a cJSON.o
100         rm -rf cJSON.o
101 #
102 # Most tools compile in a straightforward way
103 #
104 % :: %.c v3_ctrl.h libv3_ctrl.a
105         $(CC) $(CFLAGS) $< -lv3_ctrl -L. -o $@
106
107
108 #
109 # Console support requires curses
110 #
111 ifeq ($(STATIC),1)
112   CURSES_CFLAGS = -DNCURSES_STATIC
113   CURSES_LIBS = -lcurses                           
114 else
115   CURSES_CFLAGS = 
116   CURSES_LIBS = -lcurses 
117 endif
118
119 v3_cons: v3_cons.c
120         $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
121
122 v3_cons_sc: v3_cons_sc.c
123         $(CC) $(CFLAGS) $(CURSES_CFLAGS) $< $(CURSES_LIBS) -o $@
124
125 v3_create: v3_create.c ezxml.c libv3_ctrl.a 
126         $(CC) $(CFLAGS) $^ -lv3_ctrl -L. -o $@
127
128
129
130 #
131 # User host devices include a library and some examples
132 #
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
137
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 $@
140
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 $@
143
144 #
145 # Guarded module registration for GEARS
146 #
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 $@
149
150 #
151 # User keyed stream support includes a library and examples
152 #
153 #
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
158
159
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 $@
162
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 $@
165
166
167 # guest memory access by mmap and example
168 #
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
172         rm -f v3_guest_mem.o
173
174 v3_guest_mem_access : v3_guest_mem_access.c libv3_guest_mem.a
175         $(CC) $(CFLAGS) $< -L. -lv3_guest_mem -o $@
176
177
178 #
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
184         rm -rf v3_fb.o 
185
186
187
188 #
189 # VNC support is compiled separately
190 #
191 v3_x0vncserver : 
192         @if [ -a x0vncserver ] ; \
193         then \
194                 cp x0vncserver v3_x0vncserver ; \
195         else \
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"; \
199         fi;
200
201 #
202 # GUI is compiled separately
203 #
204 v3_x0gui : 
205         @if [ -a gui/Palacios ] ; \
206         then \
207                 cp gui/Palacios v3_x0gui ; \
208         else \
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";\
212         fi;
213
214 #
215 # Cleanup and dependency builds are automated
216 #
217 clean:
218         rm -f $(BUILD_EXECS) $(BUILD_LIBS) $(COPIED_EXECS)
219
220 depend:
221         $(CC) -MM $(CFILES) -I../linux_module > .dependencies
222