Hello, On Mon, 01 Nov 2010, David C. Rankin wrote: [..]
CC = gcc
ok.
CFLAGS = -Wall -lm -lgsl -lgslcblas
*blam* Don't put libs (i.e. -lfoo) into CFLAGS, use LIBS and/or LDFLAGS. CFLAGS := -O2 -Wall -W -Wno-unused LDFLAGS := -Wl,-as-needed LIBS := -lgslcblas -lgsl -lm (don't libs have to be named on a use-first-implementation-after basis? Anyway, with -as-needed, the linker (ld) _will_ tell you ;)
OBJECTS = isolv_state.o tst_isolv.o
ok.
tstim : $(OBJECTS) $(CC) -o tstim $(OBJECTS) $(CFLAGS)
isolv_state.o : isolv_state.c isolv_state.h $(CC) -c isolv_state.c
tst_isolv.o : tst_isolv.c isolv_state.h $(CC) -c tst_isolv.c
You should avoid such explicit rules. They're a pain to maintain! Either use the builtin rule (and add dependencies as needed), or spell the deps out. And/or define your custom "pattern" rule. ==== UNTESTED ==== CC := gcc CFLAGS := -O2 CFLAGS += -Wall -W -Wno-unused # [..] CCLD := $(CC) LDFLAGS := -Wl,-as-needed # ### debug linking process: # LDFLAGS += -Wl,-t LIBS := -lgslcblas -lgsl -lm # [..] tstim: $(OBJECTS) $(CCLD) $(LDFLAGS) -o $@ $^ $(LIBS) %.o: %.c: $(CC) $(CFLAGS) -o $@ $< isolv_state.o: isolv_state.h tst_isolv.o: isolv_state.h ==== Or something like that (as I don't know how gcc specific some of those options are, I use ":="). You could use "?=" or "=" to cater for other compilers, but you'd have to be sure about defaults you add to CFLAGS and LDFLAGS etc. pp. You might have to use :: instead of the simple : there. Or just generate the deps to those *.h files (gcc -M...). HTH, -dnh, with eyelids barely staying open ... but liking 'make' a lot for solving dependencies ;) -- The rest of the time you want to carefully slice open their scrotum, extract their testicles, still attached, dip them in egg batter, roll them in italian bread crumbs, and fry them with a little olive oil. Then you make the little bastard cut them off and eat 'em. -- random, in the Monastery -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org