makefiles

D'Arcy J.M. Cain darcy at druid.uucp
Fri Jun 15 22:09:36 AEST 1990


In article <411 at comcon.UUCP> tim at comcon.UUCP (Tim Brown) writes:
>I have been wrestling with this problem, I *have* RTFM and still I am
>a little confused.  I wrote some functions and put them into a
>library.  Can someone suggest the best way to maintain the library
>with as few lines as possible but still maintain it the same way as
>individually targeted objects?
>
Here's the pertinent part of my local library makefile.  I use GNU Make.

CC=gcc
CFLAGS =	-O -Wall
UNIX_L =	/usr/lib/libcain.a
OBJECTS =	parse nx_wk_dy strmem calcsecs asc_date \
			now scandate scantime crctab chkenv \
			getarg addext fullname qsort ssearch

all:	$(foreach o, $(OBJECTS), $o.o)
	ar r $(UNIX_L) $?

You may wish to use "module.o" instead of "module" in the variable assignment
and drop the foreach.  I only use it because the full file compiles the modules
for DOS at the same time.

-- 
D'Arcy J.M. Cain (darcy at druid)     |   Government:
D'Arcy Cain Consulting             |   Organized crime with an attitude
West Hill, Ontario, Canada         |
(416) 281-6094                     |



More information about the Comp.lang.c mailing list