Browse Source

Initial commit

main
Annwan 1 year ago
commit
6ad47845ab
  1. 3
      .gitignore
  2. 40
      Build.moon
  3. 0
      README

3
.gitignore

@ -0,0 +1,3 @@
/*.o
/nc

40
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

0
README

Loading…
Cancel
Save