Skip to content

Commit

Permalink
Merge pull request #200251 from Homebrew/makefile-heredoc
Browse files Browse the repository at this point in the history
formulae: use MAKE heredoc delimiter for Makefile
  • Loading branch information
p-linnane authored Dec 6, 2024
2 parents 282f89a + 317441d commit 264622e
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions Formula/b/bmake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def install
end

test do
(testpath/"Makefile").write <<~EOS
(testpath/"Makefile").write <<~MAKE
all: hello
hello:
\t@echo 'Test successful.'
@echo 'Test successful.'
clean:
\trm -rf Makefile
EOS
rm -rf Makefile
MAKE
system bin/"bmake"
system bin/"bmake", "clean"
end
Expand Down
8 changes: 4 additions & 4 deletions Formula/b/bsdmake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def install
end

test do
(testpath/"Makefile").write <<~EOS
(testpath/"Makefile").write <<~MAKE
foo:
\ttouch $@
EOS
touch $@
MAKE

system bin/"bsdmake"
assert_predicate testpath/"foo", :exist?
assert_path_exists testpath/"foo"
end
end
6 changes: 3 additions & 3 deletions Formula/c/compiledb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def install
end

test do
(testpath/"Makefile").write <<~EOS
(testpath/"Makefile").write <<~MAKE
all:
cc main.c -o test
EOS
MAKE
(testpath/"main.c").write <<~C
int main(void) { return 0; }
C

system bin/"compiledb", "-n", "make"
assert_predicate testpath/"compile_commands.json", :exist?, "compile_commands.json should be created"
assert_path_exists testpath/"compile_commands.json", "compile_commands.json should be created"
end
end
6 changes: 3 additions & 3 deletions Formula/d/distcc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def install
test do
system bin/"distcc", "--version"

(testpath/"Makefile").write <<~EOS
(testpath/"Makefile").write <<~MAKE
default:
\t@echo Homebrew
EOS
@echo Homebrew
MAKE
assert_match "distcc hosts list does not contain any hosts", shell_output("#{bin}/pump make 2>&1", 1)

# `pump make` timeout on linux runner and is not reproducible, so only run this test for macOS runners
Expand Down
10 changes: 5 additions & 5 deletions Formula/m/make.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ def caveats
end

test do
(testpath/"Makefile").write <<~EOS
(testpath/"Makefile").write <<~MAKE
default:
\t@echo Homebrew
EOS
@echo Homebrew
MAKE

if OS.mac?
assert_equal "Homebrew\n", shell_output("#{bin}/gmake")
assert_equal "Homebrew\n", shell_output("#{opt_libexec}/gnubin/make")
assert_equal "Homebrew\n", shell_output(bin/"gmake")
assert_equal "Homebrew\n", shell_output(libexec/"gnubin/make")
else
assert_equal "Homebrew\n", shell_output(bin/"make")
end
Expand Down
8 changes: 4 additions & 4 deletions Formula/n/netsurf-buildsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ def install
test do
(testpath/"src").mkpath

(testpath/"Makefile").write <<~EOS
(testpath/"Makefile").write <<~MAKE
COMPONENT := hello
COMPONENT_VERSION := 0.1.0
COMPONENT_TYPE ?= binary
include $(NSSHARED)/makefiles/Makefile.tools
include $(NSBUILD)/Makefile.top
INSTALL_ITEMS := $(INSTALL_ITEMS) /bin:$(BUILDDIR)/$(COMPONENT)
EOS
MAKE

(testpath/"src/Makefile").write <<~EOS
(testpath/"src/Makefile").write <<~MAKE
DIR_SOURCES := main.c
include $(NSBUILD)/Makefile.subdir
EOS
MAKE

(testpath/"src/main.c").write <<~C
#include <stdio.h>
Expand Down
10 changes: 5 additions & 5 deletions Formula/r/remake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ class Remake < Formula
depends_on "readline"

def install
system "./configure", *std_configure_args, "--disable-silent-rules"
system "./configure", "--disable-silent-rules", *std_configure_args
system "make", "install"
# Remove texinfo files for make to avoid conflict
info.glob("make.info*").map(&:unlink)
rm info.glob("make.info*")
end

test do
(testpath/"Makefile").write <<~EOS
(testpath/"Makefile").write <<~MAKE
all:
\techo "Nothing here, move along"
EOS
echo "Nothing here, move along"
MAKE
system bin/"remake", "-x"
end
end

0 comments on commit 264622e

Please sign in to comment.