-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxfig.mk.in.in
181 lines (156 loc) · 4.95 KB
/
xfig.mk.in.in
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# -*- Makefile -*-
#
# Makefile fragment for processing xfig files to produce postscript
#
# Copyright (c) 2002-2023 Dan McMahill
# All rights reserved.
#
# 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; version 2 of the License.
#
# 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
# Copyright (c) 2002, 2003 Dan McMahill
# All rights reserved.
#######################################
#
# README:
#
# To use this makefile fragment, set the variable:
# XFIGSRCS = the xfig drawing files (.fig files)
# in your top level Makefile. You can also specify
# XFIGDIRS which is a list of directories containing
# xfig files. All xfig files in the specified directories
# are added to XFIGSRCS
#
# The following variables may be overridden in your top level Makefile
#
# FIG2DEV = the fig2dev executable
# FIG2DEV_FLAGS = flags passed to fig2dev for all exporting
# FIG2DEV_EPS_FLAGS = flags passed to fig2dev for exporting to eps
# FIG2DEV_PDF_FLAGS = flags passed to fig2dev for exporting to pdf
#
#######################################
# how to call fig2dev to convert xfig files to postscript
FIG2DEV?= @FIG2DEV@
FIG2DEV_FLAGS?=
FIG2DEV_EPS_FLAGS?= -L eps
FIG2DEV_PDF_FLAGS?= -L pdf
#######################################
#
# Process XFIGDIRS, adding to XFIGSRCS
#
#######################################
BMK:.if defined(XFIGDIRS)
BMK:.for __tmp__ in ${XFIGDIRS}
BMK:.if exists(${__tmp__})
BMK:_XFIG_ADD_${__tmp__}!= ls ${__tmp__}/*.fig
BMK:XFIGSRCS+= ${_XFIG_ADD_${__tmp__}}
BMK:.endif
BMK:.endfor
BMK:.endif
GMK:ifdef XFIGDIRS
GMK:XFIGSRCS+= $(foreach __tmp__,$(XFIGDIRS),$(wildcard $(__tmp__)/*.fig))
GMK:endif
#######################################
#
# Process proj_XFIGDIRS, adding to proj_XFIGSRCS
#
#######################################
BMK:.for __name__ in ${NAME}
BMK:.if defined(${__name__}_XFIGDIRS)
BMK:.for __tmp__ in ${${__name__}_XFIGDIRS}
BMK:.if exists(${__tmp__})
BMK:_XFIG_ADD2_${__tmp__}!= ls ${__tmp__}/*.fig
BMK:${__name__}_XFIGSRCS+= ${_XFIG_ADD2_${__tmp__}}
BMK:.endif
BMK:.endfor
BMK:.endif
BMK:.endfor
GMK:define xfigdirs_template
GMK:ifdef $(1)_XFIGDIRS
GMK:$(1)_XFIGSRCS+= $(foreach __tmp2__,$($(1)_XFIGDIRS),$(wildcard $(__tmp2__)/*.fig))
GMK:endif
GMK:endef
GMK:$(foreach __tmp__,$(NAME),$(eval $(call xfigdirs_template,$(__tmp__))))
#######################################
#
# Process proj_XFIGSRCS to add to
# proj_OTHER dependencies
#
#######################################
# if we are using pdflatex, then don't bother with the .eps files
# but create .pdf files instead
BMK:.if defined(USE_PDFLATEX)
GMK:ifdef USE_PDFLATEX
XFIGOBJS?= $(XFIGSRCS:.fig=.pdf)
BMK:.else
GMK:else
XFIGOBJS?= $(XFIGSRCS:.fig=.eps)
BMK:.endif
GMK:endif
ALLXFIGOBJS+= $(XFIGOBJS)
BMK:.for __tmp__ in ${NAME}
BMK:.if defined(${__tmp__}_XFIGSRCS)
BMK:.if defined(USE_PDFLATEX)
BMK:${__tmp__}_XFIGOBJS?= ${${__tmp__}_XFIGSRCS:.fig=.pdf}
BMK:.else
BMK:${__tmp__}_XFIGOBJS?= ${${__tmp__}_XFIGSRCS:.fig=.eps}
BMK:.endif
BMK:${__tmp__}_OTHER+= ${${__tmp__}_XFIGOBJS}
BMK:ALLXFIGOBJS+= ${${__tmp__}_XFIGOBJS}
BMK:.endif
BMK:${__tmp__}_DIST+= ${${__tmp__}_XFIGSRCS} ${XFIGSRCS}
BMK:.endfor
GMK:# note, this had to be done in two steps (create proj_XFIGOBJS,
GMK:# and then add to proj_OTHER and ALLXFIGOBJS) with GNU make 3.80
GMK:# don't really know why.
GMK:define xfigobjs_template
GMK:ifdef $(1)_XFIGSRCS
GMK:ifdef USE_PDFLATEX
GMK:$(1)_XFIGOBJS?= ${$(1)_XFIGSRCS:.fig=.pdf}
GMK:else
GMK:$(1)_XFIGOBJS?= ${$(1)_XFIGSRCS:.fig=.eps}
GMK:endif
GMK:endif
GMK:$(1)_DIST+= ${$(1)_XFIGSRCS} ${XFIGSRCS}
GMK:endef
GMK:$(foreach __tmp__,$(NAME),$(eval $(call xfigobjs_template,$(__tmp__))))
GMK:define xfigdeps_template
GMK:ifdef $(1)_XFIGSRCS
GMK:$(1)_OTHER+= ${$(1)_XFIGOBJS}
GMK:ALLXFIGOBJS+= ${$(1)_XFIGOBJS}
GMK:endif
GMK:endef
GMK:$(foreach __tmp__,$(NAME),$(eval $(call xfigdeps_template,$(__tmp__))))
#######################################
#
# Add the dependencies
#
#######################################
OTHER+= $(XFIGOBJS)
all:: $(ALLXFIGOBJS)
clean::
BMK:.for __tmp__ in $(ALLXFIGOBJS)
BMK: $(RM) -f $(__tmp__:Q)
BMK:.endfor
GMK: $(RM) -f $(ALLXFIGOBJS)
#######################################
#
# The suffix rules
#
#######################################
.SUFFIXES : .fig .eps .pdf
.fig.eps :
BMK: $(FIG2DEV:Q) $(FIG2DEV_FLAGS) $(FIG2DEV_EPS_FLAGS) $*.fig $*.eps
GMK: $(FIG2DEV) $(FIG2DEV_FLAGS) $(FIG2DEV_EPS_FLAGS) $*.fig $*.eps
.fig.pdf :
BMK: $(FIG2DEV:Q) $(FIG2DEV_FLAGS) $(FIG2DEV_PDF_FLAGS) $*.fig $*.pdf
GMK: $(FIG2DEV) $(FIG2DEV_FLAGS) $(FIG2DEV_PDF_FLAGS) $*.fig $*.pdf