summaryrefslogtreecommitdiff
path: root/Makerules.am
blob: f571043f2bc75edf5a179f72aa481c3276f30b8c (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
# Makerules: how to do some things.

# Copyright 2006 Free Software Foundation, Inc.

# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
#
# THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS
# "AS IS" CONDITION.  THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY
# LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
# USE OF THIS SOFTWARE.

#
# Building foo.h from foo.sym.
#

%.symc: %.sym $(top_srcdir)/gensym.awk
	$(AWK) -f $(word 2,$^) $< > $@
%.symc.o: %.symc
	$(COMPILE) -S -x c -o $@ $<
%.h: %.symc.o
	sed < $< > $@				\
	  -e 's/^[^*].*$$//'			\
	  -e 's/^[*]/#define/'			\
	  -e 's/mAgIc[^-0-9]*//'

#
# Building RPC stubs.
#

# 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 following four rules and the lib_dep_tr_for_defs.a
# machinery (see Makefrag.am and i386/Makefrag.am).
%.server.defs.c: %.srv
	rm -f $@
	cp -p $< $@
%.user.defs.c: %.cli
	rm -f $@
	cp -p $< $@
%.server.h %.server.c: lib_dep_tr_for_defs_a-%.server.defs.$(OBJEXT)
	$(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMSFLAGS)	\
	  -sheader $*.server.h -server $*.server.c	\
	  -user /dev/null -header /dev/null		\
	  < $<
%.msgids: lib_dep_tr_for_defs_a-%.server.defs.$(OBJEXT)
	$(MIGCOM) $(MIGCOMFLAGS)		\
	  -n -list $@				\
	  < $<
%.user.h %.user.c: lib_dep_tr_for_defs_a-%.user.defs.$(OBJEXT)
	$(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMUFLAGS)		\
	  -user $*.user.c -server /dev/null -header $*.user.h	\
	  < $<
%.msgids: lib_dep_tr_for_defs_a-%.user.defs.$(OBJEXT)
	$(MIGCOM) $(MIGCOMFLAGS)		\
	  -n -list $@				\
	  < $<

# 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.defs
	$(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMSFLAGS)	\
	  -sheader $*.server.h -server $*.server.c	\
	  -user /dev/null -header /dev/null		\
	  < $<
# 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.defs
	$(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMUFLAGS)		\
	  -user $*.user.c -server /dev/null -header $*.user.h	\
	  < $<

#
# gzip files.
#

%.gz: %
	$(GZIP) -9 < $< > $@

#
# strip files.
#

%.stripped: %
	$(STRIP) -o $@ $<

#
# Echo target.
#

echo-%:
	@echo '$* = `$($*)'\'