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.


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