Remove Makefiles

They don't work for me (on Debian bullseye). For example, from the
example/sdl-imageviewer directory:

$ make
g++   -lSDL2 -lSDL2_image  sdl-imageviewer.cc   -o sdl-imageviewer
/usr/bin/ld: /tmp/cciX1mj2.o: in function `draw(SDL_Window*)':
sdl-imageviewer.cc:(.text+0x36e44): undefined reference to `SDL_GetWindowSurface'
/usr/bin/ld: sdl-imageviewer.cc:(.text+0x36e69): undefined reference to `SDL_CreateRenderer'
/usr/bin/ld: sdl-imageviewer.cc:(.text+0x36e79): undefined reference to `SDL_RenderClear'
etc
collect2: error: ld returned 1 exit status
make: *** [<builtin>: sdl-imageviewer] Error 1

Swapping the g++ args around to

g++ sdl-imageviewer.cc -lSDL2 -lSDL2_image -o sdl-imageviewer

works, but the recommended approach is to use the existing top-level
build-example.sh script instead.
This commit is contained in:
Nigel Tao committed 2021-10-03 14:06:16 +11:00
1 parent 2453a8d52a
commit 68acf24515
3 files changed
+8 -19

No files matched your search

+8 -3
View File
@@ -42,18 +42,23 @@ for f in $sources; do
if [ $f = imageviewer ]; then
# example/imageviewer is unusual in that needs additional libraries.
echo "Building gen/bin/example-$f"
$CXX -O3 example/$f/*.cc -lxcb -lxcb-image -o gen/bin/example-$f
$CXX -O3 example/$f/*.cc \
-lxcb -lxcb-image -lxcb-render -lxcb-render-util \
-o gen/bin/example-$f
elif [ $f = "sdl-imageviewer" ]; then
# example/sdl-imageviewer is unusual in that needs additional libraries.
echo "Building gen/bin/example-$f"
$CXX -O3 example/$f/*.cc -lSDL2 -lSDL2_image -o gen/bin/example-$f
$CXX -O3 example/$f/*.cc \
-lSDL2 -lSDL2_image \
-o gen/bin/example-$f
elif [ $f = "toy-genlib" ]; then
# example/toy-genlib is unusual in that it uses separately compiled
# libraries (built by "wuffs genlib", e.g. by running build-all.sh) instead
# of directly #include'ing Wuffs' .c files.
if [ -e gen/lib/c/$CC-static/libwuffs.a ]; then
echo "Building gen/bin/example-$f"
$CC -O3 -static -I.. example/$f/*.c gen/lib/c/$CC-static/libwuffs.a -o gen/bin/example-$f
$CC -O3 -static -I.. example/$f/*.c gen/lib/c/$CC-static/libwuffs.a \
-o gen/bin/example-$f
else
echo "Skipping gen/bin/example-$f; run \"wuffs genlib\" first"
fi
-8
View File
@@ -1,8 +0,0 @@
SHELL = /bin/sh
LDFLAGS = -lxcb -lxcb-image -lxcb-render -lxcb-render-util
all: imageviewer
clean:
rm -f imageviewer
.PHONY: all clean
-8
View File
@@ -1,8 +0,0 @@
SHELL = /bin/sh
LDFLAGS = -lSDL2 -lSDL2_image
all: sdl-imageviewer
clean:
rm -f sdl-imageviewer
.PHONY: all clean