NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: What is BSD make?
> 3. mk.conf/make.conf
mk.conf is just like user's .shrc ;-) There user can implement their
own "libraries", things that are outside their projects but used while
development.
For example, I implement there 'cvsdist' target which creates
a tarball of the projects based on PROJECTNAME and VERSION variables
taking everything from cvs by tag PROJECTNAME-VERSION.
> 5. .depend
> This would be nice to reuse, though it isn't obvious to me,
> which way. I have a feeling, that this can cover some things,
> which autoconf tries to do. Unfortunatly, there're no publicized
> examples of how to do it.
'make depend' ?
bsd.subdir.mk also supports "depend" target.
> 6. .OBJDIR
> This is the most sophisticated part. Noone knows how it works exactly,
IMHO it is documented good enough enough.
( Recently there were discussion about ... about everything :-) in
debian-russian mailing list, as a result of that flame I wrote the
example code reimplementing my autoconf/gmake-based dictd )
0 dictd_bsd_make>export MAKEOBJDIRPREFIX=/tmp/some/where
0 dictd_bsd_make>mkdir -p /tmp/some/where
0 dictd_bsd_make>make obj
obj ===> libmaa
# objdir /tmp/some/where/home/cheusov/prjs/dictd_bsd_make/libmaa
obj ===> dict_common
# objdir /tmp/some/where/home/cheusov/prjs/dictd_bsd_make/dict_common
obj ===> dict
...
0 dictd_bsd_make>make
all ===> libmaa
# compile libmaa/1.ln
lint -chapbxzFS -i /home/cheusov/prjs/dictd_bsd_make/libmaa/1.c
# compile libmaa/1.o
cc -O2 -Werror -c /home/cheusov/prjs/dictd_bsd_make/libmaa/1.c -o 1.o
objcopy -x 1.o
...
0 dictd_bsd_make>find /tmp/some/where -type f
/tmp/some/where/home/cheusov/prjs/dictd_bsd_make/libmaa/1.ln
/tmp/some/where/home/cheusov/prjs/dictd_bsd_make/libmaa/1.o
/tmp/some/where/home/cheusov/prjs/dictd_bsd_make/libmaa/1.po
...
0 dictd_bsd_make>
> Object directory also complicates linking.
> You cant simply write:
> LDADD+= ../../lib/this/this.a
> DPADD+= ../../lib/this/this.a
Everything work just fine ;-)
0 dictd_bsd_make>cat dict/Makefile
PROG= dict
.include "../dict_common/Makefile.inc"
.include "../libmaa/Makefile.inc"
.include <bsd.prog.mk>
0 dictd_bsd_make>cat dict_common/Makefile.inc
LDFLAGS+= -L../dict_common
LDADD+= -ldict_common
DPADD+= ../dict_common/libdict_common.a
0 dictd_bsd_make>make
...
cc -O2 -Werror -c -DGPROF -DPROF -pg
/home/cheusov/prjs/dictd_bsd_make/dict_common/3.c -o 3.po
objcopy -X 3.po
# build dict_common/libdict_common.a
...
cc -O2 -Werror -c /home/cheusov/prjs/dictd_bsd_make/dict/dict.c
# link dict/dict
cc -L../dict_common -L../libmaa -o dict -Wl,-rpath-link,/lib:/usr/lib
-L/lib dict.o -ldict_common -lmaa
...
0 dictd_bsd_make>ls -la
/tmp/some/where/home/cheusov/prjs/dictd_bsd_make/dict/dict
-rwxr-xr-x 1 cheusov wheel 5465 Oct 13 10:34
/tmp/some/where/home/cheusov/prjs/dictd_bsd_make/dict/dict
0 dictd_bsd_make>
> 2. You have to track dependencies manually, unless you're using
> pkgsrc and building package.
Dependencies between project - yes, In example above dict/dictd/dictd
depends on libmaa and dict_common library. This is why they include
../libmaa/Makefile.inc.
Dependancies between file - no, see 'make depend'.
> 3. Recursive makes.
I personally don't beleive in "Recursive make considered harmful" by
Peter Miller. Most of those problems can easily be solved using bmake.
BTW, "one project - one directory" is not a limitations.
Exactly this solves some of problems with recursive make.
> I have absolutely no idea how to handle recursive makes right now.
Natively with bsd.subdir.mk?
> To sweeten this a bit I should add that my linux colleagues didn't
> even try to address OBJDIR.
Simplest example is above.
--
Best regards, Aleksey Cheusov.
Home |
Main Index |
Thread Index |
Old Index