[comp.unix.programmer] Make into archive in XENIX

hendrik@zeusa.UUCP (Hendrik Vermooten) (11/24/90)

Hi, all.

When I use the Makefile (listed below) under XENIX, it compiles modules
that have changed twice. For instance, if I "touch strvalid.c" and then
type "make -n", I get:

  cc -c -O strvalid.c
  ar rv c.a strvalid.o
  rm -f strvalid.o
  cc -c -O strvalid.c
  ar rv c.a strvalid.o
  cp c.a /lib/386/SlibC.a
  ranlib /lib/386/SlibC.a
  rm -f strvalid.o

Am I doing something wrong? TFM doesn't shed any light! [Yes, the
appropriate lines DO start with tabs: I just took them out in the posting]

Makefile:
--------------------------------

.PRECIOUS: c.a

c.a: c.a(alloc.o) c.a(dates.o) c.a(dtemonth.o) c.a(time.o) c.a(dtextend.o) c.a(dteformt.o)\
    c.a(edit.o) c.a(datedit.o) c.a(editnum.o) c.a(getparam.o) c.a(zfgets.o)\
    c.a(filename.o) c.a(funclib.o) c.a(head.o) c.a(dos.o) c.a(utils.o)\
    c.a(keyboard.o) c.a(logging.o) c.a(xlate.o) c.a(list.o)\
    c.a(lowprint.o) c.a(mystring.o) c.a(parser.o) c.a(encrypt.o)\
    c.a(passwd.o) c.a(pool.o) c.a(prcode.o) c.a(printer.o) c.a(showtic.o)\
    c.a(ptrbug.o) c.a(pushpop.o) c.a(regexp.o) c.a(ringmenu.o) c.a(backup.o)\
    c.a(round.o) c.a(select.o) c.a(selfile.o) c.a(setpassw.o) c.a(filescan.o)\
    c.a(showerr.o) c.a(strvalid.o) c.a(sysdate.o) c.a(funckey.o) c.a(calc.o)\
    c.a(sysexit.o) c.a(terminal.o) c.a(text.o) c.a(trace.o) c.a(typeahea.o)
  $(CC) -c $(CFLAGS) $(?:.o=.c)
  ar rv c.a $?
  cp c.a /lib/386/SlibC.a
  ranlib /lib/386/SlibC.a
  rm -f $?
-- 
--------------------- He who laughs last laughs last ---------------------
Hendrik Vermooten, ZEUS software    TEL +27 12 64-5507, FAX +27 12 64-8382
Bang: ..!uunet!ddsw1!olsa99!zeusa!hendrik     or        hendrik@zeusa.UUCP
----------------- He whose laugh lasts longest laughs last ---------------

andre@targon.UUCP (andre) (12/07/90)

In article <881@zeusa.UUCP> hendrik@zeusa.UUCP (Hendrik Vermooten) writes:
>When I use the Makefile (listed below) under XENIX, it compiles modules
>that have changed twice. For instance, if I "touch strvalid.c" and then

Your Makefile is essentially in the form:

all: lib.a(obj.o)
	: make objects
	: put objects in library
	ranlib

but make already knows the dependencies (internally)

lib.a(obj.o): obj.o
obj.o: obj.c

so make will update this object by CC and AR'ing for you if
it finds the obj.c.

Therefore the make objects and ar objects lines are not necessary.
You can see what built in rules your make has by invoking make -np.

-- 
The mail|    AAA         DDDD  It's not the kill, but the thrill of the chase.
demon...|   AA AAvv   vvDD  DD        Ketchup is a vegetable.
hits!.@&|  AAAAAAAvv vvDD  DD                    {nixbur|nixtor}!adalen.via
--more--| AAA   AAAvvvDDDDDD    Andre van Dalen, uunet!hp4nl!targon!andre