From 48acf30cd49d006085238d43a7f1aff8eff6dfe3 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 24 Dec 2023 21:17:24 -0500 Subject: [PATCH] GNUmakefile: new build dir structure, only install necessary files --- GNUmakefile | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9c2eaa9..8b490ed 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -15,33 +15,32 @@ PREFIX=/usr/local CC=cc -CFLAGS=-O3 -Lbuild +CFLAGS=-O3 -Lbuild/lib ifeq ($(CC), gcc) - CFLAGS=-O3 -s -Wl,-z,noseparate-code,-z,nosectionheader -flto -Lbuild + CFLAGS=-O3 -s -Wl,-z,noseparate-code,-z,nosectionheader -flto -Lbuild/lib endif ifeq ($(CC), clang) - CFLAGS=-O3 -Wall -Lbuild + CFLAGS=-O3 -Wall -Lbuild/lib endif ifeq ($(CC), tcc) - CFLAGS=-O3 -s -Wl -flto -Lbuild + CFLAGS=-O3 -s -Wl -flto -Lbuild/lib endif build: build_dir false intcmp scrut str strcmp true build_dir: - mkdir -p build + mkdir -p build/o build/lib build/bin clean: rm -rf build/ install: build mkdir -p $(PREFIX)/bin $(PREFIX)/lib $(PREFIX)/man/man1 $(PREFIX)/man/man3 - cp -f build/*.o $(PREFIX)/lib/ - cp -f build/*.so $(PREFIX)/lib/ - cp -f build/* $(PREFIX)/bin/ + cp -f build/lib/*.so $(PREFIX)/lib/ + cp -f build/bin/* $(PREFIX)/bin/ cp -f docs/*.1 $(PREFIX)/man/man1/ cp -f docs/*.3 $(PREFIX)/man/man3/ @@ -50,24 +49,24 @@ test: build tests/posix-compat.sh false: src/false.c build_dir - $(CC) $(CFLAGS) -o build/false src/false.c + $(CC) $(CFLAGS) -o build/bin/false src/false.c intcmp: src/intcmp.c build_dir - $(CC) $(CFLAGS) -o build/intcmp src/intcmp.c + $(CC) $(CFLAGS) -o build/bin/intcmp src/intcmp.c scrut: src/scrut.c libfileis build_dir - $(CC) $(CFLAGS) -lfileis -o build/scrut src/scrut.c + $(CC) $(CFLAGS) -lfileis -o build/bin/scrut src/scrut.c str: src/str.c build_dir - $(CC) $(CFLAGS) -o build/str src/str.c + $(CC) $(CFLAGS) -o build/bin/str src/str.c strcmp: src/strcmp.c build_dir - $(CC) $(CFLAGS) -o build/strcmp src/strcmp.c + $(CC) $(CFLAGS) -o build/bin/strcmp src/strcmp.c true: src/true.c build_dir - $(CC) $(CFLAGS) -o build/true src/true.c + $(CC) $(CFLAGS) -o build/bin/true src/true.c libfileis: src/libfileis.c src/libfileis.h build_dir - $(CC) $(CFLAGS) -c -fPIC -o build/libfileis.o src/libfileis.c - $(CC) -shared -o build/libfileis.so build/libfileis.o + $(CC) $(CFLAGS) -c -fPIC -o build/o/libfileis.o src/libfileis.c + $(CC) -shared -o build/lib/libfileis.so build/o/libfileis.o