From: Alan T. DeKok Date: Thu, 13 Sep 2012 12:56:25 +0000 (+0200) Subject: Fix pattern substitution to work only for C/CPP X-Git-Tag: release_3_0_0_beta1~1717 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1593836b175b0b338f46461d8340467cf17205f;p=thirdparty%2Ffreeradius-server.git Fix pattern substitution to work only for C/CPP $(SRCS:.c=.o) followed by $(SRCS:.cpp=.o) results in any ".c" files being added to the output. Using GNU Make features helps fix this --- diff --git a/src/modules/rules.mak b/src/modules/rules.mak index cd159a1a55c..e2401878b7e 100644 --- a/src/modules/rules.mak +++ b/src/modules/rules.mak @@ -40,8 +40,9 @@ all: build-module # along with a number of other useful definitions. # ####################################################################### -LT_OBJS += $(SRCS:.c=.lo) -LT_OBJS += $(SRCS:.cpp=.lo) +LT_OBJS := $(patsubst %.c,%.lo,$(filter %.c,$(SRCS))) +LT_OBJS += $(patsubst %.cxx,%.lo,$(filter %.cxx,$(SRCS))) +LT_OBJS += $(patsubst %.cpp,%.lo,$(filter %.cpp,$(SRCS))) CFLAGS += -I$(top_builddir)/src $(INCLTDL) ####################################################################### @@ -63,7 +64,6 @@ $(LT_OBJS): $(SERVER_HEADERS) # ####################################################################### %.lo: %.c - @echo CC $< @echo CC $< @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(RLM_CFLAGS) -c $< @@ -123,10 +123,10 @@ build-module: $(TARGET).la $(RLM_UTILS) done $(TARGET).la: $(RLM_SUBDIRS) $(LT_OBJS) - @echo LINK $@ $^ + @echo LINK $@ $(filter %.lo,$^) @$(LIBTOOL) --quiet --mode=link $(CC) -release $(RADIUSD_VERSION) \ -module $(LINK_MODE) $(LDFLAGS) $(RLM_LDFLAGS) -o $@ \ - -rpath $(libdir) $^ $(LIBRADIUS) $(RLM_LIBS) $(LIBS) + -rpath $(libdir) $(filter %.lo,$^) $(LIBRADIUS) $(RLM_LIBS) $(LIBS) ####################################################################### #