summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2018-02-05 19:00:46 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2018-02-05 19:00:46 -0800
commite839091ba05083f166356f5455cea7ba3adad8d6 (patch)
tree775e92ff552d2523bb48a85f9c1828bfd7e7761e /Makefile
parentf8d9fc3a9db8114c8f82b6b707127ba04f877bdb (diff)
downloadabc-e839091ba05083f166356f5455cea7ba3adad8d6.tar.gz
abc-e839091ba05083f166356f5455cea7ba3adad8d6.tar.bz2
abc-e839091ba05083f166356f5455cea7ba3adad8d6.zip
Suggested fix to compile on FreeBSD.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 11 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index ffaac859..3ca76f5f 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@ $(info $(MSG_PREFIX)Using CXX=$(CXX))
$(info $(MSG_PREFIX)Using LD=$(LD))
PROG := abc
+OS := $(shell uname -s)
MODULES := \
$(wildcard src/ext*) \
@@ -73,6 +74,10 @@ ABC_READLINE_LIBRARIES ?= -lreadline
ifndef ABC_USE_NO_READLINE
CFLAGS += -DABC_USE_READLINE $(ABC_READLINE_INCLUDES)
LIBS += $(ABC_READLINE_LIBRARIES)
+ ifeq ($(OS), FreeBSD)
+ CFLAGS += -I/usr/local/include
+ LDFLAGS += -L/usr/local/lib
+ endif
$(info $(MSG_PREFIX)Using libreadline)
endif
@@ -118,7 +123,11 @@ endif
endif
# LIBS := -ldl -lrt
-LIBS += -ldl -lm
+LIBS += -lm
+ifneq ($(OS), FreeBSD)
+ LIBS += -ldl
+endif
+
ifneq ($(findstring Darwin, $(shell uname)), Darwin)
LIBS += -lrt
endif
@@ -191,7 +200,7 @@ tags:
$(PROG): $(OBJ)
@echo "$(MSG_PREFIX)\`\` Building binary:" $(notdir $@)
- $(VERBOSE)$(LD) -o $@ $^ $(LIBS)
+ $(VERBOSE)$(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
lib$(PROG).a: $(LIBOBJ)
@echo "$(MSG_PREFIX)\`\` Linking:" $(notdir $@)