|
From: | Garrett Cooper |
Subject: | Re: Issues with compiling dependent objects |
Date: | Wed, 28 May 2008 11:39:57 -0700 |
Hi again,
I'm having issues with compiling .a / .la (library archives), with dependent objects (.o). For whatever reason I can't get the .a / .la archive to be created unless the dirname for the library archive and the objects are the same.
# Makefile
# $(CURDIR) is $(srcdir)/lib/ltp
LIB_TARGET := $(srcdir)/lib/libltp.a
MAKE_DEPS := $(patsubst %.c,%.o,$(wildcard *.c))
MAKE_TARGETS := $(LIB_TARGET)
$(LIB_TARGET): $(MAKE_TARGET)
# ------
# Master rule:
%.a:
ar -rc $@ $^
So the essential rule set should be:
%.o: %.c
$(srcdir)/lib/libltp.a: $(patsubst %.c,%.o,$(wildcard $(srcdir)/lib/ltp/*.c))
ar -rc $@ $^
But make refuses to do:
%.o: %.c
I even inserted the implicit rule and make refuses to connect the dots...
Furthermore, I just inserted $(CURDIR) in front of $(wildcard ...), and it still refuses to do the right thing.
Isn't this supposed to be evaluated automatically to the expected answer of .c -> .o?
Thanks,
-Garrett
[Prev in Thread] | Current Thread | [Next in Thread] |