# FreeBSD Program Compiling-Installing



## ligregni (Mar 6, 2010)

Hi everyone!

I am a FreeBSD user since 3 years ago, I now I am getting started in it's development. The first trouble I got is: "how to implement the changes I made?"

For example, I want to modify the source code of audit.c located at /usr/src/sys/security/audit/audit.c, OK, I just put a line and wanna see that line working, but, I am in the issue that there is no Makefile in that level, the first Makefile appears in /usr/src/sys and when I type


```
cd /usr/src/sys
make
```

It shows these lines:


```
===> boot (all)
===> boot/ficl (all)
===> boot/efi (all)
===> boot/efi/libefi (all)
===> boot/zfs (all)
===> boot/i386 (all)
===> boot/i386/mbr (all)
===> boot/i386/pmbr (all)
===> boot/i386/boot0 (all)
===> boot/i386/boot0sio (all)
===> boot/i386/btx (all)
===> boot/i386/btx/btx (all)
===> boot/i386/btx/btxldr (all)
===> boot/i386/btx/lib (all)
===> boot/i386/boot2 (all)
===> boot/i386/cdboot (all)
===> boot/i386/gptboot (all)
===> boot/i386/zfsboot (all)
===> boot/i386/gptzfsboot (all)
===> boot/i386/kgzldr (all)
===> boot/i386/libi386 (all)
===> boot/i386/libfirewire (all)
===> boot/i386/loader (all)
===> boot/i386/zfsloader (all)
===> boot/i386/pxeldr (all)
```

I am quite a newbie in FreeBSD development... but, I am almost sure that's not the effect of compiling ALL the sources in /usr/src/sys/* and installing them, or is it?

So, one thing I did many times is rebuilding the entire kernel and installing it (it's necessary, for example, to set mi Wireless card) but I will not be happy if I have to wait two hours (or more) just to see if one line of code worked (it's just the testing phase, obviously, I hope later they will be two lines of code each compiling... )

I tried to make another Makefile in sys but this time changing:


```
# Directories to include in cscope name file and TAGS.
CSCOPEDIRS=	boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
		geom gnu isa kern libkern modules net net80211 netatalk \
		netgraph netinet netinet6 netipsec netipx netnatm netncp \
		netsmb nfs nfsclient nfsserver nlm opencrypto \
		pci rpc security sys ufs vm xdr ${CSCOPE_ARCHDIR}
```

by


```
# Directories to include in cscope name file and TAGS.
CSCOPEDIRS=	bsm \
		security ${CSCOPE_ARCHDIR}
```

then ran:


```
make -f Makefile2
```

but got the same result as before.

Thanks in advance for get the time reading this and be sure I have researched here in forums and in the internet but getting no answer, so I call for expert's help.

Greetings from Mexico!


----------



## lyuts (Mar 7, 2010)

I believe you can type 
	
	



```
make security
```
 while being in /usr/src/sys


----------



## trasz@ (Mar 8, 2010)

When you're modifying file that gets compiled into the kernel, you have to rebuild the kernel.  Doing "make buildkernel" in /usr/src does that.  If you don't want it to recompile everything, use "KERNFAST", e.g. "make buildkernel KERNFAST=1".

You might want to read "man build", btw.


----------

