summaryrefslogtreecommitdiff
path: root/Makerules.mig.am
blob: 8ae65557fb90d136fc80d0fc3b970fd5b119cb30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Makerules.mig: how to do some MIG-related things.

# Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# 
# Written by Thomas Schwinge.

# serial 0

# TODO.  This file should probably be distributed with GNU MIG and then there
# should be some mechanism so that every package using it is automagically
# using the latest available (or best-matching) version of it.  Which is not
# trivial, as the file is already needed to build the build system.  But then,
# this file does not really depend on GNU Automake.  Hmm...

# USAGE.

# Before `include'ing this file, `noinst_LIBRARIES' and `MOSTLYCLEANFILES' have
# to be initialized.

# For using these rules, `AM_CPPFLAGS', `MIGCOM', `MIGCOMFLAGS', `MIGCOMSFLAGS'
# and `MIGCOMUFLAGS' have to be defined as desired.

# Then you can (read: currently ``have to''; see below for comments) use
# constructs like:
#
# # User stubs.
# nodist_lib_dep_tr_for_defs_a_SOURCES += \
# 	vm/memory_object_user.user.defs.c
# nodist_libkernel_a_SOURCES += \
# 	vm/memory_object_user.user.h \
# 	vm/memory_object_user.user.c \
# 	vm/memory_object_user.user.msgids
#
# # Server stubs.
# nodist_lib_dep_tr_for_defs_a_SOURCES += \
# 	device/device.server.defs.c
# nodist_libkernel_a_SOURCES += \
# 	device/device.server.h \
# 	device/device.server.c \
# 	device/device.server.msgids

#
# Building RPC stubs.
#

# TODO.  Get rid of that stuff, lib_dep_tr_for_defs.a and the four following
# rules.  See the thread at
# <http://lists.gnu.org/archive/html/automake/2006-10/msg00039.html> about what
# we really want to do.  This requires work on GNU Automake.

noinst_LIBRARIES += \
	lib_dep_tr_for_defs.a
nodist_lib_dep_tr_for_defs_a_SOURCES =
MOSTLYCLEANFILES += \
	$(nodist_lib_dep_tr_for_defs_a_SOURCES)
# Preprocess only.
lib_dep_tr_for_defs_a_CPPFLAGS = $(AM_CPPFLAGS) \
	-E

%.server.defs.c: %.srv
	$(AM_V_at) rm -f $@
	$(AM_V_GEN) cp -p $< $@
%.server.h %.server.c %.server.msgids: lib_dep_tr_for_defs_a-%.server.defs.$(OBJEXT)
	$(MIGCOM_V) $(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMSFLAGS)	\
	  -sheader $*.server.h -server $*.server.c		\
	  -list $*.server.msgids				\
	  < $<
%.user.defs.c: %.cli
	$(AM_V_at) rm -f $@
	$(AM_V_GEN) cp -p $< $@
%.user.h %.user.c %.user.msgids: lib_dep_tr_for_defs_a-%.user.defs.$(OBJEXT)
	$(MIGCOM_V) $(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMUFLAGS)	\
	  -user $*.user.c -header $*.user.h			\
	  -list $*.user.msgids					\
	  < $<
# Stand-alone rule to generate the list of message ids when neither
# the client nor the server stubs are required.
%.none.defs.c: %.defs
	$(AM_V_at) rm -f $@
	$(AM_V_GEN) cp -p $< $@
%.none.msgids: lib_dep_tr_for_defs_a-%.none.defs.$(OBJEXT)
	$(MIGCOM_V) $(MIGCOM) $(MIGCOMFLAGS)			\
	  -list $*.none.msgids					\
	  < $<

# This is how it should be done, but this is not integrated into GNU Automake
# and is missing automatic inter-file dependency management because of that.

# These chained rules could be (and used to be) single rules using pipes or
# could even --- if you dare to --- use the `mig' shell script, but it's
# convenient to be able to explicitly make the intermediate files when you want
# to deal with a problem in the MIG stub generator.

# TODO.  Get rid of the .srv files and rather use .defs files and MIG*SFLAGS?
#%.server.defs: %.srv
#	$(CPP) $(AM_CPPFLAGS) $(CPPFLAGS) -o $@ $<
#%.server.defs: %.defs
#	$(CPP) $(AM_CPPFLAGS) $(CPPFLAGS) $(MIGSFLAGS) -o $@ $<
#%.server.h %.server.c %.server.msgids: %.server.defs
#	$(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMSFLAGS)	\
#	  -sheader $*.server.h -server $*.server.c	\
#	  -list $*.server.msgids			\
#	  < $<
# TODO.  Get rid of the .cli files and rather use .defs files and MIG*UFLAGS?
#%.user.defs: %.cli
#	$(CPP) $(AM_CPPFLAGS) $(CPPFLAGS) -o $@ $<
#%.user.defs: %.defs
#	$(CPP) $(AM_CPPFLAGS) $(CPPFLAGS) $(MIGUFLAGS) -o $@ $<
#%.user.h %.user.c %.user.msgids: %.user.defs
#	$(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMUFLAGS)	\
#	  -user $*.user.c -header $*.user.h		\
#	  -list $*.user.msgids				\
#	  < $<