Maintaining a library with make

Maintaining a library with make

Post by Naoki Sai » Fri, 07 Oct 1994 07:47:17



Dear Unix experts,
I would like to maintain a library consisting of several files with different
compilation options.  That is, I would like to keep e.g., two different archive
files, libtest.a and libtest-dbg.a compiled with -O and -g flags respectively.
Suppose I have two files in the library, a.c and b.c.  In this case, what is the
best strategy to maintain these libraries?
One example might be:

SRCS = a.c b.c
OBJS = $(SRCS:%.c=%.o)
OBJDIR = obj
HDRS = a.h b.h
CFLAGS = -O
%.o: %.c

.KEEP_STATE:
.INIT: $(HDRS)
all: $(OBJS)
        mv *.o $(OBJDIR)
        ar r libtest.a $(OBJDIR)/$(OBJS)
debug:= CFLAGS=-g
debug:= OBJDIR=obj-dbg
debug: $(OBJS)
        mv *.o $(OBJDIR)
        ar r libtest-dbg.a $(OBJDIR)/$(OBJS)

------
However, everytime I say make debug (even without modifiying or touching *.[ch] files)
it tries to recompile again.  What's wrong here?  I would appreciate if you could
give a better strategy to maintain various versions of library such as above.

Best regards and thanks in advance,
---

Schlumberger-Doll Research

 
 
 

1. Making shared libraries from vendor libraries

I recall a few years ago reading about a method to convert vendor libraries
into shared libraries.  I think it involved disassembling the objects in the
library and doing some "sed" type things to it and then reassembling with
proper options to allow linkage into a shared library.  However, I don't
remember the details.

I am particularly interested in convering Oracle's libraries into shared
libraries.  Has anyone out there done this on Solaris 2.3?  (I'm also
interested in SunOS 4.1.x and Solaris 2.4 if its a different procedure).
If so any tips you can provide or scripts you've used to successfully do this
would help me a great deal.  Please send any information to me via e-mail
since our news feed can be a bit flakey.

thanks,
dave

or

2. Creative Labs 4X CDR problems.

3. Help on Makefiles and using/maintaining user libraries

4. AutoPPP

5. Maintaining Shared Libraries

6. How to resume a file in ncftp.

7. Maintaining a function library: sample Makefile wanted

8. CDE Backdrop Problem

9. can libraries be made to load> 0x40000000

10. Making a library shared

11. Making a library

12. making a library be executeable

13. help w/ making library