ladybird/Base/res/devel/templates/cpp-library.postcreate
kleines Filmröllchen fd68e9f1ac Base: Split out cpp-library template files into actual files
These were part of the postcreate script previously, but with the new
powers of sed, we can text-replace the library name and make changing
them much more convenient.
2023-05-05 02:15:43 +03:30

28 lines
518 B
Text

#!/bin/Shell
# $1: Project name, filesystem safe
# $2: Project full path
# $3: Project name, namespace safe
# FIXME: Use a single sed command once we support that.
sed -i "s/\\\$LibName/$3/g" $2/Class1.h
sed -i "s/\\\$LibName/$3/g" $2/Class1.cpp
# Generate 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