01.09.2014 Views

The Linux Development Platform Configuring, Using, and ... - Classes

The Linux Development Platform Configuring, Using, and ... - Classes

The Linux Development Platform Configuring, Using, and ... - Classes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CH04.fm Page 128 Monday, October 7, 2002 8:54 PM<br />

128 Chapter 4 • <strong>Using</strong> GNU make<br />

# Default Target<br />

dnsresolver: $(SRCS) $(HDRS)<br />

$(CC) $(CFLAGS) $(INCLUDES) dnsresolver.c<br />

$(CC) $(LDFLAGS) $(COMMON) $(OBJS) -lcommon -o dnsresolver<br />

install:<br />

cp dnsresolver $(INSTALLDIR)<br />

clean:<br />

@echo "Deleting files ..."<br />

rm -f dnsresolver $(OBJS) *~<br />

4.4.6 Building Everything<br />

After going through these makefiles, you are ready to build the targets. Go to the top<br />

directory <strong>and</strong> run the make comm<strong>and</strong> from there. It will read the makefile in the top directory<br />

<strong>and</strong> will try to build all targets. A typical output of this action is as follows:<br />

[root@conformix make]# make<br />

#######################################<br />

### BUILDING ALL TARGETS ###<br />

#######################################<br />

for i in common-dir ftp-dir tftp-dir dns-dir ; do \<br />

( cd $i ; make ) ; \<br />

done<br />

make[1]: Entering directory `/root/make/common-dir'<br />

gcc -g -O2 -c common.c<br />

ar -cr libcommon.a common.o<br />

ranlib libcommon.a<br />

make[1]: Leaving directory `/root/make/common-dir'<br />

make[1]: Entering directory `/root/make/ftp-dir'<br />

gcc -g -O2 -c -I../common-dir ftp.c<br />

gcc -static -L../common-dir ftp.o -lcommon -o ftp<br />

make[1]: Leaving directory `/root/make/ftp-dir'<br />

make[1]: Entering directory `/root/make/tftp-dir'<br />

gcc -g -O2 -c -I../common-dir tftp.c<br />

gcc -static -L../common-dir tftp.o -lcommon -o tftp<br />

make[1]: Leaving directory `/root/make/tftp-dir'<br />

make[1]: Entering directory `/root/make/dns-dir'<br />

gcc -g -O2 -c -I../common-dir dnsresolver.c<br />

gcc -static -L../common-dir dnsresolver.o -lcommon -o<br />

dnsresolver<br />

make[1]: Leaving directory `/root/make/dns-dir'<br />

[root@conformix make]#

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!