From 6ad47845ab722a9140c0977610fc22248ad620a7 Mon Sep 17 00:00:00 2001 From: Annwan Date: Wed, 30 Aug 2023 19:48:45 +0200 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ Build.moon | 40 ++++++++++++++++++++++++++++++++++++++++ README | 0 3 files changed, 43 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..9955bdd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/*.o +/nc + 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