Merge branch 'master' of https://git.code.sf.net/p/cdesktopenv/code
[oweals/cde.git] / cde / programs / dtappbuilder / Makefile.include
1
2 #
3 #       $XConsortium: Makefile.include /main/3 1995/11/06 17:09:05 rswiston $
4 #
5 #  %W% %G%      cde_app_builder
6 #
7 #       RESTRICTED CONFIDENTIAL INFORMATION:
8 #       
9 #       The information in this document is subject to special
10 #       restrictions in a confidential disclosure agreement between
11 #       HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
12 #       document outside HP, IBM, Sun, USL, SCO, or Univel without
13 #       Sun's specific written approval.  This document and all copies
14 #       and derivative works thereof must be returned or destroyed at
15 #       Sun's request.
16 #
17 #       Copyright 1993 Sun Microsystems, Inc.  All rights reserved.
18 #
19 #
20
21 #
22 # This file is meant to be included in each Makefile associated with
23 # a particular project.  The following parameters should be defined
24 # by the including Makefile, as appropriate:
25 #
26 #       PROJECTDIR      Top-level project directory
27 #       LIBRARY         Target library
28 #       PROGRAM         Target program
29 #       LOCALE          Locale to install into
30 #       SOURCES.G       GUIDE Intermediate Languages
31 #       SOURCES.c       C code
32 #       SOURCES.uil     UIL files
33 #       SOURCES.xres    X Resource files
34 #       SOURCES.h       Include files
35 #       SOURCES.l       Lex files
36 #       SOURCES.sh      Shell scripts
37 #       SOURCES.y       Yacc files
38 #       SOURCES.pkg     SVR4 package files
39 #       SOURCES.po      Localization message files (only for testing)
40 #       IMAGES          Bitmap/icon files
41 #
42 # Note that the localization items (e.g., .mo files are not shipped as
43 # part of guide.  They are installed into a test directory (for testing,
44 # even).
45 #
46
47 #
48 # Switch build environment based on OS.  Automatically switches
49 # for 4.1.x or 5.X builds.  Override with:
50 #
51
52 # Solaris 2.0 bundles OpenWindows with the environment and
53 # locates it in /usr/openwin. When compiling under 5.0, either
54 # don't set OPENWINHOME, or make sure that it is set to
55 # /usr/openwin so that LD_RUN_PATH (-R) is correct. If OpenWindows
56 # is located somewhere else, then make a link from /usr/openwin to
57 # that location before compiling.
58 WIN_HOME:sh = \
59  (                                      \
60    case ${OPENWINHOME}                  \
61    in ?*) echo ${OPENWINHOME};;         \
62        *) echo "/usr/openwin";;         \
63    esac;                                \
64  )
65
66 MOTIFHOME:sh = \
67  (                                      \
68    case ${MOTIFHOME}                    \
69    in ?*) echo ${MOTIFHOME};;           \
70        *) echo "/opt/SUNWmotif";;       \
71    esac;                                \
72  )
73
74 # Derived parameters.
75
76 SOURCES += \
77         $(SOURCES.h) \
78         $(SOURCES.G) \
79         $(SOURCES.l) \
80         $(SOURCES.y) \
81         $(SOURCES.uil) \
82         $(SOURCES.xres) \
83         $(SOURCES.c) \
84         $(SOURCES.ps) \
85         $(SOURCES.cps) \
86         $(SOURCES.sh) \
87         $(SOURCES.misc) \
88         $(SOURCES.other) \
89         $(SOURCES.pkg) \
90         $(SOURCES.po)
91
92 TARGETS.c = \
93         $(SOURCES.G:%.G=%_ui.c) \
94         $(STUBS.G:%.G=%_stubs.c) \
95         $(SOURCES.l:%.l=%.c) \
96         $(SOURCES.y:%.y=%.c)
97
98 TARGETS.h = \
99         $(SOURCES.G:%.G=%_ui.h) \
100         $(SOURCES.y:%.y=%.h) \
101         $(SOURCES.cps:%.cps=%.h)
102
103 TARGETS.uid = \
104         $(SOURCES.uil:%.uil=uid/%.uid)
105
106 TARGETS.other = \
107         $(SOURCES.G:%.G=%.info)
108
109 TARGETS.sh = \
110         $(SOURCES.sh:%.sh=%)
111
112 TARGETS.mo = \
113         $(SOURCES.po:%.po=%.mo)
114
115 TARGETS = \
116         $(TARGETS.other) \
117         $(TARGETS.sh) \
118         $(TARGETS.h) \
119         $(TARGETS.c) \
120         $(TARGETS.uid) \
121         $(TARGETS.mo)
122
123 OBJECTS = \
124         $(SOURCES.c:%.c=%.o) \
125         $(TARGETS.c:%.c=%.o)
126
127 #
128 # The project dir (i.e. PROJECTDIR) relative to the build include and lib
129 # directories (i.e. $(PROJECTDIR)/include/ab, $(PROJECTDIR)/lib).
130 #
131 BUILDINCPROJ = ../..
132
133 DESTDIR = $(PROJECTDIR)/installed
134
135 INSTALL += $(PROGRAM)$(TARGETS.sh)      # no space!!!
136 INSTDIR = $(DESTDIR)/bin
137
138 INSTALL.a += $(LIBRARY)
139 INSTDIR.a += $(DESTDIR)/lib
140
141 INSTALL.h +=
142 INSTDIR.h = $(DESTDIR)/include
143
144 INSTALL.ps += $(SOURCES.ps)
145 INSTDIR.ps = $(DESTDIR)/etc
146
147 INSTALL.other += $(TARGETS.other)
148 INSTDIR.other = $(DESTDIR)/lib/locale/C/help
149
150 INSTALL.misc += $(SOURCES.misc)
151 INSTDIR.misc = $(DESTDIR)/lib
152
153 INSTALL.mo += $(TARGETS.mo)
154 INSTDIR.mo = $(DESTDIR)/test-l10n/lib/locale/$(LOCALE)/LC_MESSAGES
155
156 INSTALL.svr4 += $(SOURCES.pkg)
157 INSTDIR.svr4 = $(DESTDIR)/svr4_installed
158
159 # OS dependent stuff
160
161 INST = /usr/ucb/install
162
163 CC = cc 
164
165 LN = ln -s
166
167
168 PKGINST = /usr/ucb/install
169
170 # Compiler flags.
171
172 CFLAGS += -Xc -g
173 CPPFLAGS += -I$(PROJECTDIR)/src/include -I$(WIN_HOME)/include
174 LDFLAGS += -L$(WIN_HOME)/lib -R$(WIN_HOME)/lib -L$(PROJECTDIR)/src/lib
175 LINTFLAGS += -b
176 G2CFLAGS += -s -n
177 ULIBS += $(PROJECTDIR)/src/lib/libAButil.a
178 .PRECIOUS: $(ULIBS) $(LIBRARY)
179
180 # Standard targets.
181
182 .KEEP_STATE:
183 all:     $(SOURCES) $(IMAGES) $(TARGETS) .WAIT $(LIBRARY) $(PROGRAM)
184 objects: $(SOURCES.c) $(TARGETS.c) $(TARGETS.h) $(TARGETS.mo) .WAIT $(OBJECTS)
185 sources: $(SOURCES) $(IMAGES)
186 targets: $(SOURCES) $(IMAGES) $(TARGETS)
187
188 $(PROGRAM): $(SOURCES) $(TARGETS) $(OBJECTS) $(ULIBS)
189         $(PURIFY) $(LINK.c) -o $(PROGRAM) $(OBJECTS) $(ULIBS) $(LDLIBS)
190
191 %_ui.c: %.G
192         $(G2C) $(G2CFLAGS) $*
193 %_ui.h: %_ui.c
194         @touch $@
195 %_stubs.c: %_ui.c
196         @touch $@
197 %.info: %_ui.c
198         @touch $@
199 %.mo:   %.po
200         msgfmt $<
201 uid/%.uid: %.uil
202         $(MOTIFHOME)/bin/uil $< -o $@
203
204 # This rewrites the entire library any time an object changes (not *too* bad).
205 # Should be able to only replace new objects, but this works
206 $(LIBRARY): $(LIBRARY)($(OBJECTS))
207         $(RM) $@
208         ar rv $@ $(OBJECTS)
209
210 $(LIBRARY)(%.o): %.o
211         @true
212
213 install: all
214         @-sccs check
215         @if [ "$(INSTALL)" ] ; then \
216                 set -x ; \
217                 $(INST) -d $(INSTDIR) ; \
218                 $(INST) -m 555 $(INSTALL) $(INSTDIR) ; \
219                 if [ "$(ALT_PROGRAM_NAME)" ] ; then \
220                         if [ -f $(INSTDIR)/$(PROGRAM) ] ; then \
221                                 (cd $(INSTDIR) ; \
222                                 $(RM) $(ALT_PROGRAM_NAME) ; \
223                                 ln -s $(PROGRAM) $(ALT_PROGRAM_NAME)) ; \
224                         fi ; \
225                 fi ; \
226         fi
227         @if [ "$(INSTALL.a)" ] ; then \
228                 set -x ; \
229                 $(INST) -d $(INSTDIR.a) ; \
230                 $(INST) -m 664 $(INSTALL.a) $(INSTDIR.a) ; \
231                 (cd $(INSTDIR.a) ; chmod 444 $(INSTALL.a)) ; \
232         fi
233         @if [ "$(INSTALL.h)" ] ; then \
234                 set -x ; \
235                 $(INST) -d $(INSTDIR.h) ; \
236                 $(INST) -m 444 $(INSTALL.h) $(INSTDIR.h) ; \
237         fi
238         @if [ "$(INSTALL.share)" ] ; then \
239                 set -x ; \
240                 $(INST) -d $(DESTDIR)/share/$(INSTALL.share) ; \
241                 if [ ! -d $(DESTDIR)/$(INSTALL.share) ] ; then \
242                         (cd $(DESTDIR) ; ln -s share/$(INSTALL.share)) ; \
243                 fi ; \
244         fi
245         @if [ "$(INSTALL.libshare)" ] ; then \
246                 set -x ; \
247                 $(INST) -d $(DESTDIR)/share/lib/$(INSTALL.libshare) ; \
248                 if [ ! -d $(DESTDIR)/lib/$(INSTALL.libshare) ] ; then \
249                         (cd $(DESTDIR)/lib ; ln -s ../share/lib/$(INSTALL.libshare)) ; \
250                 fi ; \
251         fi
252         @if [ "$(INSTALL.other)" ] ; then \
253                 set -x ; \
254                 $(INST) -d $(INSTDIR.other) ; \
255                 $(INST) -m 444 $(INSTALL.other) $(INSTDIR.other) ; \
256         fi
257         @if [ "$(INSTALL.misc)" ] ; then \
258                 set -x ; \
259                 $(INST) -d $(INSTDIR.misc) ; \
260                 $(INST) -m 444 $(INSTALL.misc) $(INSTDIR.misc) ; \
261         fi
262         @if [ "$(INSTALL.ps)" ] ; then \
263                 set -x ; \
264                 $(INST) -d $(INSTDIR.ps) ; \
265                 $(INST) -m 444 $(INSTALL.ps) $(INSTDIR.ps) ; \
266         fi
267         @if [ "$(INSTALL.postinstall)" ] ; then \
268                 set -x ; \
269                 if [ ! -d $(DESTDIR)/lib/help ] ; then \
270                         (cd $(DESTDIR)/lib ; \
271                         ln -s ./$(INSTALL.postinstall)) ; \
272                 fi ; \
273         fi
274         @if [ "$(INSTALL.mo)" ] ; then \
275                 set -x ; \
276                 $(INST) -d $(INSTDIR.mo) ; \
277                 $(INST) -m 444 $(INSTALL.mo) $(INSTDIR.mo) ; \
278         fi
279         @if [ "$(INSTALL.svr4)" ] ; then \
280                 $(PKGINST) -d $(INSTDIR) ; \
281                 $(PKGINST) -m 644 $(SOURCES.pkg) $(INSTDIR) ; \
282                 $(PKGINST) -m 555 $(SOURCES.sh)  $(INSTDIR) ; \
283                 (cd $(INSTDIR) ; make_package) ; \
284         fi
285
286
287 includes: ${SOURCES.h.shipped} ${SOURCES.h.shared} ${SOURCES.h.unshared}
288         @if [ "x${SOURCES.h.shipped}" != "x" ] ; then \
289                 for file in . ${SOURCES.h.shipped} ; do \
290                   if [ "x$$file" != "x." ];then \
291                         echo "$$file    => ${PROJECTDIR}/src/include/ab"; \
292                         ${RM} ${PROJECTDIR}/src/include/ab/$$file; \
293                         ${LN} ../../${LIBPART}/$$file \
294                                 ${PROJECTDIR}/src/include/ab/$$file;\
295                   fi; \
296                 done;\
297         fi
298         @if [ "x${SOURCES.h.shared}" != "x" ] ; then \
299                 for file in . ${SOURCES.h.shared} ; do \
300                   if [ "x$$file" != "x." ];then \
301                         echo "$$file    => ${PROJECTDIR}/src/include/ab_private"; \
302                         ${RM} ${PROJECTDIR}/src/include/ab_private/$$file;\
303                         ${LN} ../../${LIBPART}/$$file \
304                                 ${PROJECTDIR}/src/include/ab_private/$$file;\
305                   fi; \
306                 done;\
307         fi
308         @ if [ "x${LIBS.shared}" != "x" ] ; then \
309                 $(INST) -d ${PROJECTDIR}/src/lib;\
310                 for file in . ${LIBS.shared} ; do \
311                     if [ "x$$file" != "x." ];then \
312                         echo "$$file   => ${PROJECTDIR}/src/lib";\
313                         ${RM} ${PROJECTDIR}/src/lib/$$file;\
314                         ${LN} ../${LIBPART}/$$file \
315                                 ${PROJECTDIR}/src/lib/$$file;\
316                     fi;\
317                 done; \
318         fi
319
320
321
322 saber_src: $(SOURCES) $(TARGETS) $(OBJECTS) $(ULIBS)
323         #load $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $(SOURCES.c) $(SOURCES.c) $(TARGETS.c) $(ULIBS) $(LDLIBS)
324
325 saber_obj: $(OBJECTS) $(ULIBS)
326         #load $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) $(OBJECTS) $(ULIBS) $(LDLIBS)
327
328 lint:
329         $(LINT.c) $(SOURCES.c)
330
331 clean:
332         $(RM) $(TARGETS) $(OBJECTS) $(SOURCES.G:%.G=%_stubs.c) core *~ ,* *.BAK .make*.lock .make.depend*
333
334 scour:  clean
335         $(RM) core $(LIBRARY) $(PROGRAM) .make*
336
337 FORCE: