Maintaining library modules with make 4.2 BSD

jal at oliveb.UUCP jal at oliveb.UUCP
Fri May 30 18:59:49 AEST 1986


Thanks for all the mailed replies I received for my query. It was my first
posting to the net, so I now realise I should have benn more explicit with
the information provided. Also I meant 'library(module.o)' not
'library(module)', which, as one person pointed out (sorry about that, Guy!),
will have make recompiling everytime.

Our setup is such that we do not keep the '.o's outside the library. Once
put in the library they are removed. Hence the library can only depend
on the sources. Nor did we want to remake the library each time a source was
modified.

One respondent (sorry, I don't have the name handy) sugested make was broken
which seems the most likely answer.

However, a careful reading of the manual entry finally provided a fairly clean
solution. The macro '$?' corresponds to the list of prerequisites which are
out of date with respect to the target. This can be used to compile just the
modified sources. An example is the best demonstration:

	SRCS = a.c b.c

	libj.a : $(SRCS)
		cc -c $?
		ar rv libj.a *.o
		rm *.o

Note that '$?' leaves the suffixes appended. This quite acceptable since we
don't have any '.o's sitting around. However, it is fairly simple to pass
the list off to a shell script and process the files there  (remember basename
only takes one string to be stripped and we may have more than one in the list).

Hope this has been of use to somebody. Once again, thanks for the replies.

Jayen.
-------------------------------------------------------------------------------



More information about the Comp.unix mailing list