]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix pattern substitution to work only for C/CPP
authorAlan T. DeKok <aland@freeradius.org>
Thu, 13 Sep 2012 12:56:25 +0000 (14:56 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 13 Sep 2012 12:56:25 +0000 (14:56 +0200)
$(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

src/modules/rules.mak

index cd159a1a55c00ad496457c752d32669725f747c5..e2401878b7e9882f5c36291acb1d4bd34955da07 100644 (file)
@@ -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)
 
 #######################################################################
 #