paul@196 | 1 | # C client interface generation rules. |
paul@196 | 2 | # |
paul@222 | 3 | # Copyright (C) 2020, 2022, 2023 Paul Boddie <paul@boddie.org.uk> |
paul@196 | 4 | # |
paul@196 | 5 | # This program is free software; you can redistribute it and/or |
paul@196 | 6 | # modify it under the terms of the GNU General Public License as |
paul@196 | 7 | # published by the Free Software Foundation; either version 2 of |
paul@196 | 8 | # the License, or (at your option) any later version. |
paul@196 | 9 | # |
paul@196 | 10 | # This program is distributed in the hope that it will be useful, |
paul@196 | 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@196 | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@196 | 13 | # GNU General Public License for more details. |
paul@196 | 14 | # |
paul@196 | 15 | # You should have received a copy of the GNU General Public License |
paul@196 | 16 | # along with this program; if not, write to the Free Software |
paul@196 | 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@196 | 18 | # Boston, MA 02110-1301, USA |
paul@196 | 19 | |
paul@150 | 20 | define client_interface_c_template = |
paul@214 | 21 | $(1)_CLIENT = $(call interfaces_to_client_c_h,$(1)) |
paul@153 | 22 | $(1)_CLIENT_IDL = $(call interfaces_to_idl,$(1)) |
paul@214 | 23 | $(1)_CLIENT_C_ = $(IDL_BUILD_DIR)/__client_c__$(1) |
paul@150 | 24 | |
paul@153 | 25 | # Reference interfaces if exported. |
paul@150 | 26 | |
paul@153 | 27 | ifdef IDL_EXPORT_DIR |
paul@153 | 28 | $(1)_CLIENT_INC = $(call export_includes,$(call interfaces_to_interface_h,$(1))) |
paul@150 | 29 | endif |
paul@150 | 30 | |
paul@214 | 31 | # All generated files depend on a target file produced by a single invocation of |
paul@214 | 32 | # the idl command. Where any generated files are missing, the invocation is |
paul@214 | 33 | # performed again. |
paul@214 | 34 | |
paul@214 | 35 | $$(foreach FILENAME,$$($(1)_CLIENT),$$(if $$(wildcard $$(FILENAME)),,$$(shell rm -f $$($(1)_CLIENT_C_)))) |
paul@214 | 36 | |
paul@214 | 37 | $$($(1)_CLIENT): $$($(1)_CLIENT_C_) |
paul@214 | 38 | @touch $$@ |
paul@214 | 39 | |
paul@214 | 40 | $$($(1)_CLIENT_C_): $$($(1)_CLIENT_IDL) $$($(1)_CLIENT_INC) $(IDL_PROG) |
paul@222 | 41 | $(IDL_PROG) $(IDL_ARGS) -d $(IDL_BUILD_DIR) --client --headers --routines --language=c $$($(1)_CLIENT_IDL) |
paul@214 | 42 | @touch $$@ |
paul@150 | 43 | endef |