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

1 year ago
  1. public var NAME: 'out'
  2. -- programs
  3. var CC: 'gcc'
  4. var LD: 'gcc'
  5. var RM: 'rm', '-f', '--'
  6. -- libs
  7. var LIBS: {}
  8. -- flags
  9. var CFLAGS: '-Wall', '-Wextra', '-Werror', (LIBS[1] and (_.pkgconfig.cflags LIBS) or {})
  10. var LDFLAGS: LIBS[1] and (_.pkgconfig.libs LIBS) or {}
  11. -- files
  12. var C_SOURCES: _.wildcard 'src/**.c'
  13. var C_OBJECTS: _.patsubst C_SOURCES, 'src/%.c', 'build/%.o'
  14. var BINARY: NAME
  15. with public default target 'all'
  16. \depends BINARY
  17. with public target 'clean'
  18. \fn => _.cmd RM, C_OBJECTS
  19. with public target 'deepclean'
  20. \after 'clean'
  21. \fn => _.cmd RM, BINARY
  22. with target BINARY
  23. \depends C_OBJECTS
  24. \produces BINARY
  25. \fn => _.cmd LD, '-o', @outfile, @infiles, LDFLAGS
  26. with target C_OBJECTS, pattern: 'build/%.o'
  27. \mkdirs!
  28. \depends 'src/%.c'
  29. \depends => _.cdeps[CC] @infile, CFLAGS
  30. \produces 'build/%.o'
  31. \fn => _.cmd CC, CFLAGS, '-c', @infile, '-o', @outfile