Dylan Baker | 5f7deb5 | 2017-09-13 11:46:13 -0700 | [diff] [blame] | 1 | # Copyright © 2017-2018 Intel Corporation |
| 2 | |
| 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | # of this software and associated documentation files (the "Software"), to deal |
| 5 | # in the Software without restriction, including without limitation the rights |
| 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | # copies of the Software, and to permit persons to whom the Software is |
| 8 | # furnished to do so, subject to the following conditions: |
| 9 | |
| 10 | # The above copyright notice and this permission notice shall be included in |
| 11 | # all copies or substantial portions of the Software. |
| 12 | |
| 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 | # SOFTWARE. |
| 20 | |
| 21 | xsltproc_args = [ |
| 22 | '--stringparam', 'man.authors.section.enabled', '0', |
| 23 | '--stringparam', 'man.copyright.section.enabled', '0', |
| 24 | '--stringparam', 'funcsynopsis.style', 'ansi', |
| 25 | '--stringparam', 'man.output.quietly', '1', |
| 26 | '--nonet', manpage_style, |
| 27 | ] |
| 28 | |
| 29 | xmls = [ |
| 30 | ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'], |
| 31 | ['drmHandleEvent', '3'], ['drmModeGetResources', '3'] |
| 32 | ] |
| 33 | foreach x : xmls |
| 34 | m = x[0] |
| 35 | s = x[1] |
| 36 | custom_target( |
| 37 | m, |
| 38 | input : files('@0@.xml'.format(m)), |
| 39 | output : '@0@.@1@'.format(m, s), |
| 40 | command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'], |
| 41 | install : true, |
| 42 | install_dir : join_paths(get_option('mandir'), 'man@0@'.format(s)), |
| 43 | build_by_default : true, |
| 44 | ) |
| 45 | endforeach |
| 46 | |
| 47 | foreach x : ['drm-mm', 'drm-gem', 'drm-ttm'] |
| 48 | gen = custom_target( |
| 49 | 'gen-@0@'.format(x), |
| 50 | input : 'drm-memory.xml', |
| 51 | output : '@0@.xml'.format(x), |
| 52 | command : [ |
| 53 | prog_sed, '-e', 's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@', |
| 54 | '@INPUT@', |
| 55 | ], |
| 56 | capture : true, |
| 57 | ) |
| 58 | custom_target( |
| 59 | '@0@.7'.format(x), |
| 60 | input : gen, |
| 61 | output : '@0@.7'.format(x, '7'), |
| 62 | command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'], |
| 63 | install : true, |
| 64 | install_dir : join_paths(get_option('mandir'), 'man7'), |
| 65 | build_by_default : true, |
| 66 | ) |
| 67 | endforeach |