From e82070ed99d422145a2971d6bfd16fd340724ead Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 4 Nov 2023 22:06:27 +0300 Subject: [PATCH] new build system --- Makefile | 13 ------------- README.md | 8 ++++++++ build.sh | 3 +++ builder.c | 7 +++++++ config.h | 14 ++++++++++++++ console-tools/Makefile | 11 ----------- coreutils/Makefile | 11 ----------- miscutils/Makefile | 11 ----------- networking/Makefile | 11 ----------- procps/Makefile | 11 ----------- shell/Makefile | 11 ----------- 11 files changed, 32 insertions(+), 79 deletions(-) delete mode 100644 Makefile create mode 100755 build.sh create mode 100644 builder.c create mode 100644 config.h delete mode 100644 console-tools/Makefile delete mode 100644 coreutils/Makefile delete mode 100644 miscutils/Makefile delete mode 100644 networking/Makefile delete mode 100644 procps/Makefile delete mode 100644 shell/Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 4076df1..0000000 --- a/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -objects = coreutils console-tools networking procps shell - -CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra -CC?=cc - -all: $(objects) - -$(objects): - echo MAKE $@ - cd $@ && $(MAKE) -B CC="$(CC)" CFLAGS="$(CFLAGS) -I../libmu" && cd .. - -clean: - rm bin/* diff --git a/README.md b/README.md index 2e92f4f..f8ae339 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,10 @@ # micro-utils +[Compile] + cc builder.c -obuilder + ./buulder + [or] + sh build.sh + +[Config] + edit config.h diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..b214bcf --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cc builder.c -Wall -Wextra -Os -s -pedantic -obuilder +./builder && rm builder diff --git a/builder.c b/builder.c new file mode 100644 index 0000000..ceb0dba --- /dev/null +++ b/builder.c @@ -0,0 +1,7 @@ +#include +#include +#include "config.h" + +int main(void) { + return 0; +} diff --git a/config.h b/config.h new file mode 100644 index 0000000..d863928 --- /dev/null +++ b/config.h @@ -0,0 +1,14 @@ +#ifndef _CONFIG_H +#define _CONFIG_H + +const char *objects[] = { + "console-tools", + "coreutils", + "networking", + "procps", + "shell" +}; + +#define CFLAGS "-Wall -Wextra -pedantic -Os -s" +#define CC "cc" +#endif diff --git a/console-tools/Makefile b/console-tools/Makefile deleted file mode 100644 index 76c8c29..0000000 --- a/console-tools/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -C_SOURCES:=$(wildcard ./*.c) -C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES)) -TARGETS:=$(C_TARGETS) - -CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra -CC?=cc - -all: ../bin $(TARGETS) - -../bin/%: %.c - $(CC) $(CFLAGS) -o $@ $< diff --git a/coreutils/Makefile b/coreutils/Makefile deleted file mode 100644 index 76c8c29..0000000 --- a/coreutils/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -C_SOURCES:=$(wildcard ./*.c) -C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES)) -TARGETS:=$(C_TARGETS) - -CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra -CC?=cc - -all: ../bin $(TARGETS) - -../bin/%: %.c - $(CC) $(CFLAGS) -o $@ $< diff --git a/miscutils/Makefile b/miscutils/Makefile deleted file mode 100644 index 76c8c29..0000000 --- a/miscutils/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -C_SOURCES:=$(wildcard ./*.c) -C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES)) -TARGETS:=$(C_TARGETS) - -CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra -CC?=cc - -all: ../bin $(TARGETS) - -../bin/%: %.c - $(CC) $(CFLAGS) -o $@ $< diff --git a/networking/Makefile b/networking/Makefile deleted file mode 100644 index 76c8c29..0000000 --- a/networking/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -C_SOURCES:=$(wildcard ./*.c) -C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES)) -TARGETS:=$(C_TARGETS) - -CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra -CC?=cc - -all: ../bin $(TARGETS) - -../bin/%: %.c - $(CC) $(CFLAGS) -o $@ $< diff --git a/procps/Makefile b/procps/Makefile deleted file mode 100644 index 76c8c29..0000000 --- a/procps/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -C_SOURCES:=$(wildcard ./*.c) -C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES)) -TARGETS:=$(C_TARGETS) - -CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra -CC?=cc - -all: ../bin $(TARGETS) - -../bin/%: %.c - $(CC) $(CFLAGS) -o $@ $< diff --git a/shell/Makefile b/shell/Makefile deleted file mode 100644 index 76c8c29..0000000 --- a/shell/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -C_SOURCES:=$(wildcard ./*.c) -C_TARGETS:=$(patsubst ./%.c, ../bin/%, $(C_SOURCES)) -TARGETS:=$(C_TARGETS) - -CFLAGS?=-s -Os -flto -pedantic -Wall -Wextra -CC?=cc - -all: ../bin $(TARGETS) - -../bin/%: %.c - $(CC) $(CFLAGS) -o $@ $<