Skip to content

Commit

Permalink
Merge pull request #754 from eregon/make-fixes
Browse files Browse the repository at this point in the history
A few fixes for the test Makefile
  • Loading branch information
larskanis committed Mar 27, 2020
2 parents 0b4e779 + 13e8ab6 commit b7f3bad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
5 changes: 1 addition & 4 deletions spec/ffi/fixtures/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEST_OBJS := $(patsubst $(SRC_DIR)/%.c, $(TEST_BUILD_DIR)/%.o, $(TEST_SRCS))
# http://weblogs.java.net/blog/kellyohair/archive/2006/01/compilation_of_1.html
JFLAGS = -fno-omit-frame-pointer -fno-strict-aliasing
OFLAGS = -O2 $(JFLAGS)
WFLAGS = -W -Wall -Wno-unused -Wno-parentheses
WFLAGS = -W -Wall -Wno-unused -Wno-unused-parameter -Wno-parentheses
PICFLAGS = -fPIC
SOFLAGS = -shared
LDFLAGS += $(SOFLAGS)
Expand All @@ -56,9 +56,6 @@ ifeq ($(OS), darwin)
ifneq ($(findstring $(CPU),ppc),)
ARCHFLAGS += -arch ppc
endif
ifneq ($(findstring $(CPU),i386 x86_64),)
ARCHFLAGS += -arch i386 -arch x86_64
endif
CFLAGS += $(ARCHFLAGS) -DTARGET_RT_MAC_CFM=0
CFLAGS += -fno-common
LDFLAGS = $(ARCHFLAGS) -dynamiclib
Expand Down
13 changes: 5 additions & 8 deletions spec/ffi/fixtures/compile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,12 @@ module TestLibrary
def self.compile_library(path, lib)
dir = File.expand_path(path, File.dirname(__FILE__))
lib = "#{dir}/#{lib}"
unless File.exist?(lib)
output = nil
FileUtils.cd(dir) do
make = ENV['MAKE'] || (system('which gmake >/dev/null') ? 'gmake' : 'make')
output = system(*%{#{make} CPU=#{CPU} OS=#{OS}}.tap{|x| puts x.inspect})
end

unless $?.success?
puts "ERROR:\n#{output}"
FileUtils.cd(dir) do
make = ENV['MAKE'] || (system('which gmake >/dev/null') ? 'gmake' : 'make')

unless system(*%{#{make} CPU=#{CPU} OS=#{OS}}.tap{ |cmd| puts cmd.inspect })
puts "ERROR: #{$?}"
raise "Unable to compile #{lib.inspect}"
end
end
Expand Down

0 comments on commit b7f3bad

Please sign in to comment.