You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
910 B
40 lines
910 B
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
|