Makefile.include 8.3 KB

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