Skip to content

Commit

Permalink
Merge pull request #14 from JuliaLang/sf/fixes
Browse files Browse the repository at this point in the history
Makefile fixes
  • Loading branch information
staticfloat authored Dec 1, 2018
2 parents bf18904 + 35473eb commit 77477f9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ OBJCONV = objconv

CPPFLAGS_add = -I$(LIBOSXUNWIND_HOME)/src -I$(LIBOSXUNWIND_HOME)/include -DNDEBUG
CFLAGS_add = -std=c99 -Wall -O3
CXXFLAGS_add = -std=c++11 -Wall -O3
LDFLAGS_add = -nodefaultlibs -Wl,-upward-lSystem -Wl,-umbrella,System
SFLAGS_add = -x assembler-with-cpp

# If `-stdlib=` is specified within our environment variables, then don't add another command line argument asking to link against it..
ifneq (,$(findstring -stdlib=,$(CC) $(CPPFLAGS) $(CXXFLAGS)))
# If our clang is new enough, then we need to add in `-stdlib=libstdc++`.
CLANG_MAJOR_VER := $(shell clang -v 2>&1 | grep LLVM | cut -d' ' -f 4 | cut -d'.' -f 1)
ifeq ($(shell [ $(CLANG_MAJOR_VER) -ge 8 ] && echo true),true)
CXXFLAGS_add = -std=c++11 -stdlib=libstdc++ -Wall -O3
LDFLAGS_add = -nodefaultlibs -stdlib=libstdc++ -Wl,-upward-lSystem -Wl,-umbrella,System
CXXFLAGS_add += -stdlib=libstdc++
LDFLAGS_add += -stdlib=libstdc++
else
CXXFLAGS_add = -std=c++11 -Wall -O3
LDFLAGS_add = -nodefaultlibs -Wl,-upward-lSystem -Wl,-umbrella,System -lstdc++
LDFLAGS_add += -lstdc++
endif
endif

# Files (in src/)
Expand Down Expand Up @@ -60,7 +65,8 @@ OBJS = $(patsubst %.c,%.c.o, \
$(CC) $(CPPFLAGS_add) $(CPPFLAGS) $(CXXFLAGS_add) $(CXXFLAGS) -c $< -o $@

%.s.o: %.s
$(CC) $(SFLAGS) $(SFLAGS_add) $(filter -m% -B% -I% -D%,$(CFLAGS_add)) -c $< -o $@
$(CC) $(SFLAGS_add) $(SFLAGS) $(filter -m% -B% -I% -D%,$(CFLAGS_add)) -c $< -o $@



libosxunwind.a: $(OBJS)
Expand All @@ -77,4 +83,4 @@ libosxunwind.dylib: $(OBJS)
clean:
rm -f $(OBJS) *.a *.dylib
distclean: clean
.SUFFIXES: .cxx

0 comments on commit 77477f9

Please sign in to comment.