CC := $(SCAN)/scan-build gcc -DFR_SCAN_BUILD
LIBTOOL :=
endif
+
+#
+# Portability cruft. This is for replacing libtroll && libltdl
+# with gcc and dlopen().
+#
+ifeq "$(USE_SHARED_LIBS)" "yes"
+LINK_MODE.exe = -export-dynamic
+CFLAGS += -fPIC
+else
+LINK_MODE.exe = -static
+endif
+
+ifneq "$(LIBTOOL)" ""
+COMPILE.c := $(LIBTOOL) --mode=compile $(CC)
+LINK.lib := $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) -rpath $(libdir) -o
+LO := lo
+LA := la
+else
+COMPILE.c := $(CC)
+LO := o
+
+ifeq "$(USE_SHARED_LIBS)" "yes"
+LINK.lib := $(CC) -shared -o
+LA := so
+else
+LINK.lib := $(AR) cru
+LA := a
+endif
+
+endif
+
+ifeq "$(LA)" "so"
+ifneq "$(findstring Darwin,$(shell uname -a))" ""
+LA := dylib
+endif
+endif
valuepair.c fifo.c packet.c event.c getaddrinfo.c vqp.c \
heap.c dhcp.c tcp.c
-LT_OBJS = $(SRCS:.c=.lo)
+LT_OBJS = $(SRCS:.c=.$(LO))
INCLUDES = ../include/radius.h ../include/libradius.h \
../include/missing.h ../include/autoconf.h \
# the other end is doing.
#CFLAGS += -DHMAC_SHA1_DATA_PROBLEMS
-ifeq ($(USE_SHARED_LIBS),yes)
-LINK_MODE = -export-dynamic
-else
-LINK_MODE = -static
-endif
-
TARGET = $(LIBPREFIX)freeradius-radius
# Define new rule for libtool objects
-%.lo : %.c
- $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
+%.$(LO) : %.c
+ $(COMPILE.c) $(CFLAGS) -c $<
.PHONY: all clean install reconfig
-all: $(TARGET).la
+all: $(TARGET).$(LA)
-$(TARGET).la: $(LT_OBJS)
- $(LIBTOOL) --mode=link $(CC) -release $(RADIUSD_VERSION) \
- $(LDFLAGS) $(LINK_MODE) -o $@ -rpath $(libdir) $^
+$(TARGET).$(LA): $(LT_OBJS)
+ $(LINK.lib) $@ $(LDFLAGS) $^
$(LT_OBJS): $(INCLUDES)
clean:
- rm -f *.o *.lo $(TARGET).la
+ rm -f *.$(LO) $(TARGET).$(LA)
rm -rf .libs
install: all