mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 09:46:04 -05:00
Base: Convert postcreate scripts to use heredoc
This commit is contained in:
parent
4c6a97e757
commit
0e5e6f2e08
Notes:
sideshowbarker
2024-07-18 07:03:19 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/0e5e6f2e081 Pull-request: https://github.com/SerenityOS/serenity/pull/9352 Reviewed-by: https://github.com/alimpfard ✅
3 changed files with 83 additions and 72 deletions
|
@ -1,19 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "PROGRAM = $1" >> $2/Makefile
|
||||
echo "OBJS = main.o" >> $2/Makefile
|
||||
echo "CXXFLAGS = -g -std=c++2a" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "all: \$(PROGRAM)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "\$(PROGRAM): \$(OBJS)" >> $2/Makefile
|
||||
echo " \$(CXX) -o \$@ \$(OBJS)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "%.o: %.cpp" >> $2/Makefile
|
||||
echo " \$(CXX) \$(CXXFLAGS) -o \$@ -c \$< " >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "clean:" >> $2/Makefile
|
||||
echo " rm \$(OBJS) \$(PROGRAM)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "run:" >> $2/Makefile
|
||||
echo " ./\$(PROGRAM)" >> $2/Makefile
|
||||
echo > $2/Makefile <<-EOF
|
||||
PROGRAM = $1
|
||||
OBJS = main.o
|
||||
CXXFLAGS = -g -std=c++2a
|
||||
|
||||
all: \$(PROGRAM)
|
||||
|
||||
\$(PROGRAM): \$(OBJS)
|
||||
\$(CXX) -o \$@ \$(OBJS)
|
||||
|
||||
%.o: %.cpp
|
||||
\$(CXX) \$(CXXFLAGS) -o \$@ -c \$<
|
||||
|
||||
clean:
|
||||
rm \$(OBJS) \$(PROGRAM)
|
||||
|
||||
run:
|
||||
./\$(PROGRAM)
|
||||
EOF
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "PROGRAM = $1" >> $2/Makefile
|
||||
echo "OBJS = main.o" >> $2/Makefile
|
||||
echo "CXXFLAGS = -lgui -g -std=c++2a" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "all: \$(PROGRAM)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "\$(PROGRAM): \$(OBJS)" >> $2/Makefile
|
||||
echo " \$(CXX) \$(CXXFLAGS) -o \$@ \$(OBJS)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "%.o: %.cpp" >> $2/Makefile
|
||||
echo " \$(CXX) \$(CXXFLAGS) -o \$@ -c \$< " >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "clean:" >> $2/Makefile
|
||||
echo " rm \$(OBJS) \$(PROGRAM)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "run:" >> $2/Makefile
|
||||
echo " ./\$(PROGRAM)" >> $2/Makefile
|
||||
echo > $2/Makefile <<-EOF
|
||||
PROGRAM = $1
|
||||
OBJS = main.o
|
||||
CXXFLAGS = -g -std=c++2a
|
||||
LDFLAGS = -lgui
|
||||
|
||||
all: \$(PROGRAM)
|
||||
|
||||
\$(PROGRAM): \$(OBJS)
|
||||
\$(CXX) \$(LDFLAGS) -o \$@ \$(OBJS)
|
||||
|
||||
%.o: %.cpp
|
||||
\$(CXX) \$(CXXFLAGS) -o \$@ -c \$<
|
||||
|
||||
clean:
|
||||
rm \$(OBJS) \$(PROGRAM)
|
||||
|
||||
run:
|
||||
./\$(PROGRAM)
|
||||
EOF
|
||||
|
|
|
@ -5,45 +5,51 @@
|
|||
# $3: Project name, namespace safe
|
||||
|
||||
# Generate Makefile
|
||||
echo "LIBRARY = $1.so" >> $2/Makefile
|
||||
echo "OBJS = Class1.o" >> $2/Makefile
|
||||
echo "CXXFLAGS = -g -std=c++2a" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "all: \$(LIBRARY)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "\$(LIBRARY): \$(OBJS)" >> $2/Makefile
|
||||
echo " \$(CXX) -shared -o \$@ \$(OBJS)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "%.o: %.cpp" >> $2/Makefile
|
||||
echo " \$(CXX) \$(CXXFLAGS) -fPIC -o \$@ -c \$< " >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo "clean:" >> $2/Makefile
|
||||
echo " rm \$(OBJS) \$(LIBRARY)" >> $2/Makefile
|
||||
echo "" >> $2/Makefile
|
||||
echo > $2/Makefile <<-EOF
|
||||
LIBRARY = $1.so
|
||||
OBJS = Class1.o
|
||||
CXXFLAGS = -g -std=c++2a
|
||||
|
||||
all: \$(LIBRARY)
|
||||
|
||||
\$(LIBRARY): \$(OBJS)
|
||||
\$(CXX) -shared -o \$@ \$(OBJS)
|
||||
|
||||
%.o: %.cpp
|
||||
\$(CXX) \$(CXXFLAGS) -fPIC -o \$@ -c \$<
|
||||
|
||||
clean:
|
||||
rm \$(OBJS) \$(LIBRARY)
|
||||
|
||||
EOF
|
||||
|
||||
# Generate 'Class1' header file
|
||||
echo "#pragma once" >> $2/Class1.h
|
||||
echo "" >> $2/Class1.h
|
||||
echo "namespace $3 {" >> $2/Class1.h
|
||||
echo "" >> $2/Class1.h
|
||||
echo "class Class1 {" >> $2/Class1.h
|
||||
echo "public:" >> $2/Class1.h
|
||||
echo " void hello();" >> $2/Class1.h
|
||||
echo "};" >> $2/Class1.h
|
||||
echo "" >> $2/Class1.h
|
||||
echo "}" >> $2/Class1.h
|
||||
echo "" >> $2/Class1.h
|
||||
echo > $2/Class1.h <<-EOF
|
||||
#pragma once
|
||||
|
||||
namespace $3 {
|
||||
|
||||
class Class1 {
|
||||
public:
|
||||
void hello();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
EOF
|
||||
|
||||
# Generate 'Class1' source file
|
||||
echo "#include \"Class1.h\"" >> $2/Class1.cpp
|
||||
echo "#include <stdio.h>" >> $2/Class1.cpp
|
||||
echo "" >> $2/Class1.cpp
|
||||
echo "namespace $3 {" >> $2/Class1.cpp
|
||||
echo "" >> $2/Class1.cpp
|
||||
echo "void Class1::hello()" >> $2/Class1.cpp
|
||||
echo "{" >> $2/Class1.cpp
|
||||
echo " printf(\"Hello friends! :^)\\n\");" >> $2/Class1.cpp
|
||||
echo "}" >> $2/Class1.cpp
|
||||
echo "" >> $2/Class1.cpp
|
||||
echo "}" >> $2/Class1.cpp
|
||||
echo "" >> $2/Class1.cpp
|
||||
echo > $2/Class1.cpp <<-EOF
|
||||
#include "Class1.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace $3 {
|
||||
|
||||
void Class1::hello()
|
||||
{
|
||||
printf("Hello friends! :^)\\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EOF
|
||||
|
|
Loading…
Add table
Reference in a new issue