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.


3570f463c1483876ad22f6673283aa884e11d1e0
[palacios.git] / palacios / build / Makefile
1 # Makefile for GeekOS kernel, userspace, and tools
2 #
3 #  Northwestern University 
4 # (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
5 # (c) 2008, Peter Dinda <pdinda@northwestern.edu> 
6
7 # Based on GeekOS Makefile:
8 # Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
9 # $Revision: 1.71 $
10
11
12 # This is free software.  You are permitted to use,
13 # redistribute, and modify it as specified in the file "COPYING".
14
15 # Required software to build GeekOS:
16 # - GNU Make (http://www.gnu.org/software/make)
17 # - gcc 2.95.2 generating code for target (i386/ELF) and host platforms
18 # - nasm (http://nasm.sourceforge.net)
19 # - Perl5, AWK (any version), egrep
20 #
21 # Cygwin (http://cygwin.com) may be used to build GeekOS.
22 # Make sure that gcc, binutils, nasm, and perl are installed.
23
24 # NOTES:
25 # - This makefile has been written carefully to work correctly
26 #   with the -j (parallel make) option.  I regularly use "make -j 2"
27 #   to speed the build process on 2 processor systems.
28
29
30 # Base address of kernel
31 #
32 # Note: at top of memory minus three pages (GDT/TSS/IDT) 
33 # minus maximum size
34 #
35 #
36 # Note that the code will initially load at 0x10000
37 #
38 # The setup code needs to copy it up to this address and jump there
39 #
40 KERNEL_BASE_ADDR := 0x00100000
41
42 # Kernel entry point function
43 KERNEL_ENTRY = $(SYM_PFX)Main
44
45
46 PROJECT_ROOT := ..
47 VPATH := $(PROJECT_ROOT)/src
48
49 #when -DNDEBUG is set the kassert functions are disabled
50 #JRLDEBUG=-DNDEBUG
51
52 # DEBUG=1 means VMM_DEBUG, VMM_INFO, and VMM_TRACE are enabled
53 # as are SERIAL_PRINT_DEBUG
54
55 DEBUG=1
56 DEBUG_SECTIONS= 
57
58 ifeq ($(DEBUG_ALL),1)
59   DEBUG_SECTIONS:= $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING -DDEBUG_CTRL_REGS -DDEBUG_INTERRUPTS -DDEBUG_IO -DDEBUG_KEYBOARD -DDEBUG_PIC -DDEBUG_PIT -DDEBUG_NVRAM -DDEBUG_EMULATOR -DDEBUG_GENERIC -DDEBUG_RAMDISK
60 endif
61
62 ifeq ($(DEBUG_SHADOW_PAGING),1)
63 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_SHADOW_PAGING
64 else 
65 ifeq ($(DEBUG_SHADOW_PAGING),0) 
66 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_SHADOW_PAGING
67 endif
68 endif
69
70 ifeq ($(DEBUG_CTRL_REGS),1)
71 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_CTRL_REGS
72 else 
73 ifeq ($(DEBUG_CTRL_REGS),0) 
74 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_CTRL_REGS
75 endif
76 endif
77
78 ifeq ($(DEBUG_INTERRUPTS),1)
79 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_INTERRUPTS
80 else 
81 ifeq ($(DEBUG_DEBUG_INTERRUPTS),0) 
82 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_INTERRUPTS
83 endif
84 endif
85
86 ifeq ($(DEBUG_IO),1)
87 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_IO
88 else 
89 ifeq ($(DEBUG_IO),0) 
90 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_IO
91 endif
92 endif
93
94 ifeq ($(DEBUG_KEYBOARD),1)
95 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_KEYBOARD
96 else 
97 ifeq ($(DEBUG_KEYBOARD),0) 
98 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_KEYBOARD
99 endif
100 endif
101
102 ifeq ($(DEBUG_PIC),1)
103 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_PIC
104 else 
105 ifeq ($(DEBUG_PIC),0) 
106 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_PIC
107 endif
108 endif
109
110 ifeq ($(DEBUG_PIT),1)
111 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_PIT
112 else 
113 ifeq ($(DEBUG_PIT),0) 
114 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_PIT
115 endif
116 endif
117
118 ifeq ($(DEBUG_NVRAM),1)
119 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_NVRAM
120 else 
121 ifeq ($(DEBUG_NVRAM),0) 
122 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_NVRAM
123 endif
124 endif
125
126 ifeq ($(DEBUG_GENERIC),1)
127 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_GENERIC
128 else 
129 ifeq ($(DEBUG_GENERIC),0) 
130 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_GENERIC
131 endif
132 endif
133
134 ifeq ($(DEBUG_EMULATOR),1)
135 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_EMULATOR
136 else 
137 ifeq ($(DEBUG_EMULATOR),0) 
138 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_EMULATOR
139 endif
140 endif
141
142 ifeq ($(DEBUG_RAMDISK),1)
143 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DDEBUG_RAMDISK
144 else 
145 ifeq ($(DEBUG_RAMDISK),0) 
146 DEBUG_SECTIONS := $(DEBUG_SECTIONS) -UDEBUG_RAMDISK
147 endif
148 endif
149
150
151 #DEBUG_SECTIONS := $(DEBUG_SECTIONS) -DTEST_NE2K
152
153 ifeq ($(DEBUG),1)
154   JRLDEBUG= -DSERIAL_PRINT_DEBUG=1 -DSERIAL_PRINT_DEBUG_LEVEL=10 -DSERIAL_PRINT=1 -DVMM_DEBUG=1 -DVMM_INFO=1 -DVMM_TRACE=1 $(DEBUG_SECTIONS)
155
156 else
157   JRLDEBUG= -DSERIAL_PRINT_DEBUG=0 -DSERIAL_PRINT_DEBUG_LEVEL=999999 -DSERIAL_PRINT=0 -DVMM_DEBUG=0 -DVMM_INFO=0 -DVMM_TRACE=0
158 endif
159
160
161 #
162 # DECODER is the decoder that will be used 
163 # currently we only support xed
164 #
165 DECODER=XED
166
167 DECODER_FLAGS=
168 DECODER_SRCS=
169 DECODER_LIBS=
170
171 ifeq ($(DECODER),XED)
172 DECODER_SRCS := vmm_xed.c
173 DECODER_FLAGS :=  -L../lib/xed
174 DECODER_LIBS := -lxed
175 else
176 # This is an error
177 endif
178
179 #
180 #TCPSTACK, uIP is used currently
181 #
182 TCPSTACK=UIP
183
184 #
185 #RAMDISK
186 #
187 RAMDISK_SRCS=
188 BOOT_FLAGS=
189
190 ifeq ($(RAMDISK_BOOT),1)
191 BOOT_FLAGS := $(BOOT_FLAGS) -DRAMDISK_BOOT
192 RAMDISK_SRCS := ramdisk.c cdrom.c
193 endif
194
195
196
197 #
198 # This is wrong for current cygwin - no changes needed
199 #
200 # Figure out if we're compiling with cygwin, http://cygwin.com
201 #
202
203 #SYSTEM_NAME := $(shell uname -s)
204 #ifeq ($(findstring CYGWIN,$(SYSTEM_NAME)),CYGWIN)
205 #SYM_PFX            := _
206 #EXTRA_C_OPTS       := -DNEED_UNDERSCORE -DGNU_WIN32
207 #EXTRA_NASM_OPTS    := -DNEED_UNDERSCORE
208 #NON_ELF_SYSTEM     := yes
209 #EXTRA_CC_USER_OPTS := -Dmain=geekos_main
210 #endif
211
212
213
214
215 # ----------------------------------------------------------------------
216 # Configuration -
217 #   Various options specifying how GeekOS should be built,
218 #   what source files to build, which user programs to build,
219 #   etc.  This is generally the only section of the makefile
220 #   that will need to be modified.
221 # ----------------------------------------------------------------------
222
223 # List of targets to build by default.
224 # These targets encompass everything needed to boot
225 # and run GeekOS.
226 ALL_TARGETS := vmm.img vm_kernel
227
228
229 # Kernel source files
230 KERNEL_C_SRCS := idt.c int.c trap.c irq.c io.c \
231         blockdev.c ide.c ne2k.c \
232         keyboard.c screen.c timer.c \
233         mem.c crc32.c \
234         gdt.c tss.c segment.c \
235         bget.c malloc.c \
236         synch.c kthread.c \
237         serial.c  reboot.c \
238         paging.c \
239         debug.c vmm_stubs.c  vm.c  pci.c\
240         queue.c  socket.c net.c ring_buffer.c \
241         main.c
242
243
244 # Kernel object files built from C source files
245 KERNEL_C_OBJS := $(KERNEL_C_SRCS:%.c=geekos/%.o)
246
247 # Kernel assembly files
248 KERNEL_ASM_SRCS := lowlevel.asm
249
250 KERNEL_GAS_SRCS := testvm.s udivdi3.s
251
252 # Kernel object files build from assembler source files
253 KERNEL_ASM_OBJS := $(KERNEL_ASM_SRCS:%.asm=geekos/%.o) 
254
255 KERNEL_GAS_OBJS := $(KERNEL_GAS_SRCS:%.s=geekos/%.o)
256
257
258 # All kernel object files
259 KERNEL_OBJS := $(KERNEL_C_OBJS) \
260   $(KERNEL_ASM_OBJS) $(KERNEL_GAS_OBJS)
261
262 # Common library source files.
263 # This library is linked into both the kernel and user programs.
264 # It provides string functions and generic printf()-style
265 # formatted output.
266 COMMON_C_SRCS := fmtout.c string.c memmove.c
267
268 # Common library object files.
269 COMMON_C_OBJS := $(COMMON_C_SRCS:%.c=common/%.o)
270
271 VMM_ASM_SRCS :=  svm_lowlevel.asm \
272 #                       vmx_lowlevel.asm
273
274 VMM_ASM_OBJS := $(VMM_ASM_SRCS:%.asm=palacios/%.o)
275
276
277 VMM_C_SRCS :=   vm_guest.c \
278                 svm.c svm_handler.c vmm.c vmm_util.c vmm_ctrl_regs.c \
279                 vmcb.c vmm_mem.c vmm_paging.c vmm_io.c vmm_debug.c svm_io.c \
280                 vmm_intr.c vmm_time.c \
281                 vmm_shadow_paging.c vm_guest_mem.c  \
282                 vm_dev.c vmm_dev_mgr.c vmm_decoder.c \
283                 svm_halt.c svm_pause.c svm_wbinvd.c \
284                 vmm_config.c vmm_hashtable.c \
285                 vmm_string.c vmm_emulator.c vmm_queue.c\
286                  $(DECODER_SRCS)
287 #               vmx.c vmcs_gen.c vmcs.c
288
289 VMM_C_OBJS := $(VMM_C_SRCS:%.c=palacios/%.o)
290
291 VMM_OBJS := $(VMM_C_OBJS) $(VMM_ASM_OBJS)
292
293
294
295
296 DEVICE_C_SRCS := generic.c keyboard.c nvram.c timer.c simple_pic.c 8259a.c 8254.c serial.c $(RAMDISK_SRCS)
297
298 DEVICE_C_OBJS := $(DEVICE_C_SRCS:%.c=devices/%.o)
299
300 DEVICE_OBJS := $(DEVICE_C_OBJS)
301
302 V3LIBS := $(DECODER_LIBS)
303
304
305 TCPSTACK_C_SRCS := psock.c timer.c uip_arp.c uip.c uip-fw.c uiplib.c uip-neighbor.c uip-split.c resolv.c
306
307 TCPSTACK_C_OBJS := $(TCPSTACK_C_SRCS:%.c=net/%.o)
308
309 TCPSTACK_OBJS := $(TCPSTACK_C_OBJS)
310
311
312
313
314 # ----------------------------------------------------------------------
315 # Tools -
316 #   This section defines programs that are used to build GeekOS.
317 # ----------------------------------------------------------------------
318
319 # Uncomment if cross compiling
320 TARGET_CC_PREFIX :=  $(PROJECT_ROOT)/../devtools/i386/bin/i386-elf-
321 #TARGET_CC_PREFIX :=  i386-elf-
322
323 # Target C compiler.  gcc 2.95.2 or later should work.
324 TARGET_CC := $(TARGET_CC_PREFIX)gcc
325 #TARGET_CC := $(TARGET_CC_PREFIX)gcc34 -m32
326
327 # Host C compiler.  This is used to compile programs to execute on
328 # the host platform, not the target (x86) platform.  On x86/ELF
329 # systems, such as Linux and FreeBSD, it can generally be the same
330 # as the target C compiler.
331 HOST_CC := gcc
332
333 # Target linker.  GNU ld is probably to only one that will work.
334 TARGET_LD := $(TARGET_CC_PREFIX)ld -melf_i386
335
336 # Target archiver
337 TARGET_AR := $(TARGET_CC_PREFIX)ar
338
339 # Target ranlib
340 TARGET_RANLIB := $(TARGET_CC_PREFIX)ranlib
341
342 # Target nm
343 TARGET_NM := $(TARGET_CC_PREFIX)nm
344
345 # Target objcopy
346 TARGET_OBJCOPY := $(TARGET_CC_PREFIX)objcopy
347
348 # Nasm (http://nasm.sourceforge.net)
349 NASM := $(PROJECT_ROOT)/../devtools/bin/nasm
350 #NASM := /opt/vmm-tools/bin/nasm
351
352 AS = as --32
353
354 # Tool to build PFAT filesystem images.
355 BUILDFAT := tools/builtFat.exe
356
357 # Perl5 or later
358 PERL := perl
359
360 # Pad a file so its size is a multiple of some unit (i.e., sector size)
361 PAD := $(PERL) $(PROJECT_ROOT)/scripts/pad
362
363 # Create a file filled with zeroes.
364 ZEROFILE := $(PERL) $(PROJECT_ROOT)/scripts/zerofile
365
366 # Calculate size of file in sectors
367 NUMSECS := $(PERL) $(PROJECT_ROOT)/scripts/numsecs
368
369
370 FD_SECTORS_PER_TRACK := $(PERL) $(PROJECT_ROOT)/scripts/numsecs_per_track
371
372
373 # ----------------------------------------------------------------------
374 # Definitions -
375 #   Options passed to the tools.
376 # ----------------------------------------------------------------------
377
378 # Flags used for all C source files
379 GENERAL_OPTS := -O -Wall $(EXTRA_C_OPTS) $(VMM_FLAGS) $(BOOT_FLAGS) -fPIC
380 CC_GENERAL_OPTS := $(GENERAL_OPTS) -Werror 
381
382 # Flags used for kernel C source files
383 CC_KERNEL_OPTS := -g -DGEEKOS -I$(PROJECT_ROOT)/include
384
385 # Flags used for VMM C source files
386 CC_VMM_OPTS := -g -I$(PROJECT_ROOT)/include -D__V3VEE__ -D__V3_32BIT__ $(DECODER_FLAGS) $(JRLDEBUG)
387
388 # Flags used for VMM C ASM files
389 NASM_VMM_OPTS := -I$(PROJECT_ROOT)/src/palacios/ -f elf $(EXTRA_NASM_OPTS)
390
391 # Flags user for kernel assembly files
392 NASM_KERNEL_OPTS := -I$(PROJECT_ROOT)/src/geekos/ -f elf $(EXTRA_NASM_OPTS)
393
394 # Flags used for common library and libc source files
395 CC_USER_OPTS := -I$(PROJECT_ROOT)/include -I$(PROJECT_ROOT)/include/libc \
396         $(EXTRA_CC_USER_OPTS)
397
398 # Flags passed to objcopy program (strip unnecessary sections from kernel.exe)
399 OBJCOPY_FLAGS := -R .dynamic -R .note -R .comment
400
401 # ----------------------------------------------------------------------
402 # Rules -
403 #   Describes how to compile the source files.
404 # ----------------------------------------------------------------------
405
406 # Compilation of kernel C source files
407
408 geekos/%.o : geekos/%.c
409         $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) $< -o geekos/$*.o
410
411
412 # Compilation of kernel assembly source files
413 geekos/%.o : geekos/%.asm
414         $(NASM) $(NASM_KERNEL_OPTS) $< -o geekos/$*.o
415
416 # Compilation of test VM
417 geekos/%.o : geekos/%.s
418         $(AS) $< -o geekos/$*.o
419
420 geekos/%.o : geekos/%.S
421         $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) $< -o geekos/$*.o
422
423 # Compilation of common library C source files
424 common/%.o : common/%.c
425         $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_USER_OPTS) $< -o common/$*.o
426
427 palacios/%.o : palacios/%.c
428         $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS) $< -o palacios/$*.o
429
430 palacios/%.o : palacios/%.asm
431         $(NASM) $(NASM_VMM_OPTS) $< -o palacios/$*.o
432
433 devices/%.o : devices/%.c
434         $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS) $< -o devices/$*.o
435
436 devices/%.o : devices/%.asm
437         $(NASM) $(NASM_VMM_OPTS) $< -o devices/$*.o
438
439 net/%.o : net/%.c
440         $(TARGET_CC) -c $(CC_GENERAL_OPTS) $(CC_VMM_OPTS)  $(CC_USER_OPTS) $< -o net/$*.o
441
442 # ----------------------------------------------------------------------
443 # Targets -
444 #   Specifies files to be built
445 # ----------------------------------------------------------------------
446
447 # Default target - see definition of ALL_TARGETS in Configuration section
448 all : $(ALL_TARGETS)
449
450
451 #geekos/vmx_lowlevel.o: $(PROJECT_ROOT)/src/geekos/vmx_lowlevel.asm
452 #       $(NASM) -O99 \
453 #       -f elf \
454 #               -I$(PROJECT_ROOT)/src/geekos/ \
455 #               $(PROJECT_ROOT)/src/geekos/vmx_lowlevel.asm \
456 #       -o $@
457
458
459 #geekos/test: geekos/test.o geekos/vmcs.o geekos/vmx_lowlevel.o 
460 #       $(CC) geekos/test.o geekos/vmcs.o geekos/vmx_lowlevel.o  -o geekos/test
461
462 # Standard floppy image - just boots the kernel
463 fd.img : geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin
464         cat geekos/fd_boot.bin geekos/setup.bin geekos/kernel.bin > _temp
465         $(PAD) _temp 512
466         cp _temp fd.img
467
468 vmm.img : fd.img
469         cp fd.img vmm.img
470         $(PAD) vmm.img 1474560
471
472 rombios_link:
473         ln -s -f ../src/vmboot/rombios/BIOS-bochs-latest rombios
474
475 vgabios_link:
476         ln -s -f ../src/vmboot/vgabios/VGABIOS-lgpl-latest.bin vgabios
477
478 force_rombios: rombios_link
479         (cd ../src/vmboot/rombios; make clean; make)
480
481 force_vgabios: vgabios_link
482         (cd ../src/vmboot/vgabios; make clean; make)
483
484 force_payload: force_rombios force_vgabios
485         ../scripts/make_payload.pl payload_layout.txt vm_kernel
486
487 inter1: force_payload
488         -make clean
489
490 world: inter1 vmm.img
491
492 # make ready to boot over PXE
493 pxe:    vmm.img
494         cp vmm.img /tftpboot/vmm.img
495
496 run: vmm.img
497         /usr/local/qemu/bin/qemu-system-x86_64 -m 1024 -serial file:serial.out -cdrom puppy.iso -fda vmm.img 
498
499
500
501
502 # Floppy boot sector (first stage boot loader).
503 geekos/fd_boot.bin : geekos/setup.bin geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/fd_boot.asm
504         $(NASM) -f bin \
505                 -I$(PROJECT_ROOT)/src/geekos/ \
506                 -DNUM_SETUP_SECTORS=`$(NUMSECS) geekos/setup.bin` \
507                 -DNUM_KERN_SECTORS=`$(NUMSECS) geekos/kernel.bin` \
508                 -DSECTORS_PER_TRACK=`$(FD_SECTORS_PER_TRACK) geekos/kernel.bin geekos/setup.bin` \
509                 $(PROJECT_ROOT)/src/geekos/fd_boot.asm \
510                 -o $@
511
512 # Setup program (second stage boot loader).
513 geekos/setup.bin : geekos/kernel.bin $(PROJECT_ROOT)/src/geekos/setup.asm
514         $(NASM) -f bin \
515                 -I$(PROJECT_ROOT)/src/geekos/ \
516                 -DENTRY_POINT=0x`egrep 'Main$$' geekos/kernel.syms |awk '{print $$1}'` \
517                 -DVMM_SIZE=`$(NUMSECS) geekos/kernel.bin` \
518                 $(PROJECT_ROOT)/src/geekos/setup.asm \
519                 -o $@
520         $(PAD) $@ 2048
521
522 # Loadable (flat) kernel image.
523 geekos/kernel.bin : geekos/kernel.exe
524         $(TARGET_OBJCOPY) $(OBJCOPY_FLAGS) -S -O binary geekos/kernel.exe geekos/kernel.bin
525         $(PAD) $@ 512
526
527 # The kernel executable and symbol map.
528 geekos/kernel.exe : $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(DEVICE_OBJS) $(TCPSTACK_OBJS) vm_kernel
529         $(TARGET_LD) -o geekos/kernel.exe -Ttext $(KERNEL_BASE_ADDR) -e $(KERNEL_ENTRY) \
530                 $(DECODER_FLAGS) \
531                 $(KERNEL_OBJS) $(COMMON_C_OBJS) $(VMM_OBJS) $(DEVICE_OBJS) $(V3LIBS) $(TCPSTACK_OBJS) -b binary vm_kernel
532         $(TARGET_NM) geekos/kernel.exe > geekos/kernel.syms
533
534
535 force:
536
537
538 #vm_kernel: force
539 #       $(PAD) vm_kernel 512
540 #       @echo "VM kernel lives at 0x100000 and is" `$(NUMSECS) vm_kernel` "sectors long"
541
542
543
544
545 # Clean build directories of generated files
546 clean :
547         for d in geekos common libc user tools palacios devices net; do \
548                 (cd $$d && rm -f *); \
549         done
550
551
552 # Build header file dependencies, so source files are recompiled when
553 # header files they depend on are modified.
554 depend : $(GENERATED_LIBC_SRCS)
555         $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \
556                 $(KERNEL_C_SRCS:%.c=$(PROJECT_ROOT)/src/geekos/%.c) \
557                 | $(PERL) -n -e 's,^(\S),geekos/$$1,;print' \
558                 > depend.mak
559         $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_USER_OPTS) \
560                 $(COMMON_C_SRCS:%.c=$(PROJECT_ROOT)/src/common/%.c) \
561                 | $(PERL) -n -e 's,^(\S),common/$$1,;print' \
562                 >> depend.mak
563         $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \
564                 $(VMM_C_SRCS:%.c=$(PROJECT_ROOT)/src/palacios/%.c) \
565                 | $(PERL) -n -e 's,^(\S),palacios/$$1,;print' \
566                 >> depend.mak
567         $(TARGET_CC) -M $(CC_GENERAL_OPTS) $(CC_KERNEL_OPTS) \
568                 $(DEVICE_C_SRCS:%.c=$(PROJECT_ROOT)/src/devices/%.c) \
569                 | $(PERL) -n -e 's,^(\S),devices/$$1,;print' \
570                 >> depend.mak
571
572 # By default, there are no header file dependencies.
573 depend.mak :
574         touch $@
575
576 include depend.mak