From d8ea6c21e41279bf104b3ca07c50293ea9165d19 Mon Sep 17 00:00:00 2001 From: Projects <> Date: Wed, 8 May 2024 15:36:45 +0200 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ Build.moon | 40 ++++++++++++++++++++++++++++++++++++++++ README | 0 3 files changed, 42 insertions(+) create mode 100644 .gitignore create mode 100644 Build.moon create mode 100644 README diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd88a40 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/*.o +/out diff --git a/Build.moon b/Build.moon new file mode 100644 index 0000000..16bff7d --- /dev/null +++ b/Build.moon @@ -0,0 +1,40 @@ +public var NAME: 'out' + +-- programs +var CC: 'gcc' +var LD: 'gcc' +var RM: 'rm', '-f', '--' + +-- libs +var LIBS: {} + +-- flags +var CFLAGS: '-Wall', '-Wextra', '-Werror', (LIBS[1] and (_.pkgconfig.cflags LIBS) or {}) +var LDFLAGS: LIBS[1] and (_.pkgconfig.libs LIBS) or {} + +-- files +var C_SOURCES: _.wildcard 'src/**.c' +var C_OBJECTS: _.patsubst C_SOURCES, 'src/%.c', 'build/%.o' +var BINARY: NAME + +with public default target 'all' + \depends BINARY + +with public target 'clean' + \fn => _.cmd RM, C_OBJECTS + +with public target 'deepclean' + \after 'clean' + \fn => _.cmd RM, BINARY + +with target BINARY + \depends C_OBJECTS + \produces BINARY + \fn => _.cmd LD, '-o', @outfile, @infiles, LDFLAGS + +with target C_OBJECTS, pattern: 'build/%.o' + \mkdirs! + \depends 'src/%.c' + \depends => _.cdeps[CC] @infile, CFLAGS + \produces 'build/%.o' + \fn => _.cmd CC, CFLAGS, '-c', @infile, '-o', @outfile diff --git a/README b/README new file mode 100644 index 0000000..e69de29