From: "Morten Winther" <none@mw--mwi.dk.lh.bsd-dk.dk> To: <none@bsd-dk--bsd-dk.dk.lh.bsd-dk.dk> Subject: makefile på BSD vs. Linux Date: Wed, 26 Mar 2003 16:16:24 +0100
Hej
Jeg har hentet lidt sovs fra min bog:
http://www.acceleratedcpp.com/details/unix-source.tar.gz (kapitel 4)
Jeg har dog et problem med at få det til at virke på min FreeBSD boks, idet
de to systemer åbenbart
ikke er enige om hvordan makefile'en skal læses.
Det vil sige at jeg ikke ender op med en main3 på FreeBSD boksen, idet
output kun giver 6 og ikke 7 filer.
Er der en som kan fortælle mig hvad forskellen skyldes og hvordan jeg tager
højde for dette? Kapitlet i FreeBSD handbook går noget let gennem makefile.
> cat makefile
CXX = g++
CC = g++
all: main1 main2 main3
Student_info.o: Student_info.cc Student_info.h
grade.o: grade.cc grade.h median.h Student_info.h
main3.o: main3.cc grade.h median.h Student_info.h
median.o: median.cc median.h
main3: main3.o grade.o median.o Student_info.o
test: all
./main1 <../data/single_grade
./main2 <../data/single_grade
./main2 <../data/grades
./main3 <../data/grades
clobber:
rm -f *.o *.exe core main1 main2 main3
>
FreeBSD:
> make all
g++ -O -pipe main1.cc -o main1
g++ -O -pipe main2.cc -o main2
g++ -O -pipe -c main3.cc
g++ -O -pipe -c grade.cc
g++ -O -pipe -c median.cc
g++ -O -pipe -c Student_info.cc
>
RedHat:
[u-1@hooft chapter04]$ make all
g++ main1.cc -o main1
g++ main2.cc -o main2
g++ -c -o main3.o main3.cc
g++ -c -o grade.o grade.cc
g++ -c -o median.o median.cc
g++ -c -o Student_info.o Student_info.cc
g++ main3.o grade.o median.o Student_info.o -o main3
[u-1@hooft chapter04]$
-- / morten mw@mwi.dk"There are only 10 types of people in the world: Those who understand binary, and those who don't"
This archive was generated by hypermail 2b30 : Wed 15 Nov 2006 - 18:24:28 CET