doc: documented DBG=1
[k8jam.git] / defaults / link / c / Jambase.link.lib.c
blob6bb84e7e940f624df07b53a05a1b7d20f6693d73
1 # /Library library : sources ;
3 # Compiles _sources_ and archives them into _library_. The intermediate
4 # objects are deleted. Calles @Object and @LibraryFromObjects
6 # If @Library is invoked with no suffix on _library_, the $(SUFLIB)
7 # suffix is used
9 rule Library {
10 LibraryFromObjects $(<) : $(>:S=$(SUFOBJ)) ;
11 Objects $(>) ;
15 ######################################################
16 # k8: REWORK!
17 ######################################################
18 #!LIBTOOL!#if $(UNIX) {
19 #!LIBTOOL!# # this rule is used to find the 'libtool' script in the current
20 #!LIBTOOL!# # path, this is required when compiling shared objects on Unix
21 #!LIBTOOL!# rule LibToolFind {
22 #!LIBTOOL!# if $(LIBTOOL) { return $(LIBTOOL) ; }
23 #!LIBTOOL!# local matches = [ Glob $(PATH) : libtool ] ;
24 #!LIBTOOL!# if ! $(matches) { Exit "could not find 'libtool' program in current path. Aborting !" ; }
25 #!LIBTOOL!# LIBTOOL = $(matches[1]) ;
26 #!LIBTOOL!# return $(LIBTOOL) ;
27 #!LIBTOOL!# }
28 #!LIBTOOL!#}
31 # /LibraryFromObjects library : objects ;
33 # Archives _objects_ into _library_. The _objects_ are then deleted
35 # If _library_ has no suffix, the $(SUFLIB) suffix is used
37 # Called by @Library rule. Most people should never call this rule
38 # directly.
40 rule LibraryFromObjects {
41 local _i _l _s ;
43 # Add grist to file names
44 _s = [ FGristFiles $(>) ] ;
45 _l = $(<:S=$(SUFLIB)) ;
47 # library depends on its member objects
48 if $(KEEPOBJS) {
49 Depends obj : $(_s) ;
50 } else {
51 Depends lib : $(_l) ;
54 # Set LOCATE for the library and its contents. The bound
55 # value shows up as $(NEEDLIBS) on the Link actions.
56 # For compatibility, we only do this if the library doesn't
57 # already have a path.
58 if ! $(_l:D) {
59 #!!MakeLocate $(_l) $(_l)($(_s:BS)) : $(LOCATE_TARGET) ;
60 MakeLocate $(_l) $(_l)($(_s:BS)) : $(LOCATE_LIB) ;
63 if $(NOARSCAN) {
64 # If we can't scan the library to timestamp its contents,
65 # we have to just make the library depend directly on the
66 # on-disk object files.
67 Depends $(_l) : $(_s) ;
68 } else {
69 # If we can scan the library, we make the library depend
70 # on its members and each member depend on the on-disk
71 # object file.
72 Depends $(_l) : $(_l)($(_s:BS)) ;
73 for _i in $(_s) {
74 Depends $(_l)($(_i:BS)) : $(_i) ;
78 Clean clean : $(_l) ;
80 if $(CRELIB) { CreLib $(_l) : $(_s[1]) ; }
82 Archive $(_l) : $(_s) ;
84 if $(RANLIB) { Ranlib $(_l) ; }
86 # If we can't scan the library, we have to leave the .o's around.
87 if ! ( $(NOARSCAN) || $(NOARUPDATE) ) { RmTemps $(_l) : $(_s) ; }