scdoc = find_program('scdoc', required: get_option('manpage'), disabler: true) if scdoc.found() sh = find_program('sh', required: true, native: true, disabler: true) man_files = ['man/smolbote.1.scd', 'man/smolbote.5.scd'] foreach input : man_files topic = input.split('/')[-1].split('.')[-3] section = input.split('.')[-2] output = '@0@.@1@'.format(topic, section) message('creating manpage target ' + output) custom_target(output, build_by_default: true, input: input, output: output, # scdoc takes input from stdin, and prints its output to stdout # meson uses 'capture' to store stdout to output, but there is no stdin toggle #command: [scdoc], #capture: true, # workaround using sh command: [sh, '-c', '@0@ < @INPUT0@ > @OUTPUT0@'.format(scdoc.path())], install: true, install_dir: '@0@/man@1@'.format(get_option('mandir'), section) ) endforeach endif # manpage