Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few fixes for the test Makefile #754

Merged
merged 2 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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