Makefile.in 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. #
  2. # Generic Makefile for libedit.
  3. #
  4. OSTYPE=$(shell uname -s)
  5. define cyg_subst_sys
  6. if uname -s | grep -i cygwin > /dev/null; then \
  7. cat $@ | sed -e s/"sys\.h"/"config.h"/g > $@.copy; \
  8. mv --force $@.copy $@; \
  9. fi
  10. endef
  11. SHELL = /bin/sh
  12. CC = @CC@
  13. AR = @AR@
  14. RANLIB = @RANLIB@
  15. CPPFLAGS = @CPPFLAGS@ -I.
  16. CFLAGS = @CFLAGS@
  17. A_CFLAGS = @A_CFLAGS@
  18. S_CFLAGS = @S_CFLAGS@
  19. LDFLAGS = @LDFLAGS@
  20. S_LDFLAGS = @S_LDFLAGS@
  21. LIBS = @LIBS@
  22. INSTALL = @INSTALL@
  23. PREFIX = @prefix@
  24. ifeq ($(OSTYPE),SunOS)
  25. CFLAGS+=-DSOLARIS -I../../include/solaris-compat
  26. endif
  27. # .c files.
  28. ACSRCS = @ACSRCS@
  29. BCSRCS = @BCSRCS@
  30. CCSRCS = @CCSRCS@
  31. # Generated .c files.
  32. AGCSRCS = @AGCSRCS@
  33. BGCSRCS = @BGCSRCS@
  34. # .h files.
  35. HDRS = @HDRS@
  36. # Generated .h files.
  37. AGHDRS = @AGHDRS@
  38. BGHDRS = @BGHDRS@
  39. # Installed .h files.
  40. IHDRS = @IHDRS@
  41. IHDR_LINKS = @IHDR_LINKS@
  42. HDR_DIRS = @HDR_DIRS@
  43. # Man pages.
  44. MAN3 = @MAN3@
  45. MAN5 = @MAN5@
  46. MAN3_LINKS = @MAN3_LINKS@
  47. MAN_DIRS = @MAN_DIRS@
  48. # Library.
  49. LIB_DIRS = @LIB_DIRS@
  50. LIB_VER = @LIB_VER@
  51. LIB_A = @LIB_A@
  52. LIB_A_LINKS = @LIB_A_LINKS@
  53. LIB_S = @LIB_S@
  54. LIB_S_LINKS = @LIB_S_LINKS@
  55. # Test program.
  56. TEST = @TEST@
  57. TCSRCS = @TCSRCS@
  58. # Clear out all paths, then set just one (default path) for the main build
  59. # directory.
  60. .PATH :
  61. .PATH : .
  62. .SUFFIXES :
  63. .SUFFIXES : .c .o .o_a .o_s
  64. all : lib_a lib_s
  65. lib_a : $(LIB_A)
  66. lib_s : $(LIB_S)
  67. test : $(TEST)
  68. install : install_hdr install_lib install_man
  69. install_hdr :
  70. @for i in $(HDR_DIRS) ; do \
  71. echo "$(INSTALL) -d $(PREFIX)/$$i/"; \
  72. $(INSTALL) -d $(PREFIX)/$$i/; \
  73. done
  74. @for i in $(IHDRS); do \
  75. echo "$(INSTALL) -m 0444 $$i $(PREFIX)/include/`dirname $$i`/"; \
  76. $(INSTALL) -m 0444 $$i $(PREFIX)/include/`dirname $$i`/; \
  77. done
  78. @f=; \
  79. for i in $(IHDR_LINKS) ""; do \
  80. if test -z "$$f" ; then \
  81. f=$$i; \
  82. else \
  83. echo "rm -f $(PREFIX)/include/$$i"; \
  84. rm -f $(PREFIX)/include/$$i; \
  85. echo "ln -s $$f $(PREFIX)/include/$$i"; \
  86. ln -s $$f $(PREFIX)/include/$$i; \
  87. f=; \
  88. fi; \
  89. done
  90. install_lib : install_lib_a install_lib_s
  91. install_lib_common :
  92. @for i in $(LIB_DIRS) ; do \
  93. echo "$(INSTALL) -d $(PREFIX)/$$i/"; \
  94. $(INSTALL) -d $(PREFIX)/$$i/; \
  95. done
  96. install_lib_a : $(LIB_A) install_lib_common
  97. $(INSTALL) -m 0644 $(LIB_A) $(PREFIX)/lib/
  98. @f=; \
  99. for i in $(LIB_A_LINKS) ""; do \
  100. if test -z "$$f" ; then \
  101. f=$$i; \
  102. else \
  103. echo "rm -f $(PREFIX)/lib/$$i"; \
  104. rm -f $(PREFIX)/lib/$$i; \
  105. echo "ln -s $$f $(PREFIX)/lib/$$i"; \
  106. ln -s $$f $(PREFIX)/lib/$$i; \
  107. f=; \
  108. fi; \
  109. done
  110. install_lib_s : $(LIB_S) install_lib_common
  111. $(INSTALL) -m 0755 $(LIB_S) $(PREFIX)/lib/
  112. @f=; \
  113. for i in $(LIB_S_LINKS) ""; do \
  114. if test -z "$$f" ; then \
  115. f=$$i; \
  116. else \
  117. echo "rm -f $(PREFIX)/lib/$$i"; \
  118. rm -f $(PREFIX)/lib/$$i; \
  119. echo "ln -s $$f $(PREFIX)/lib/$$i"; \
  120. ln -s $$f $(PREFIX)/lib/$$i; \
  121. f=; \
  122. fi; \
  123. done
  124. install_man :
  125. @for i in $(MAN_DIRS) ; do \
  126. echo "$(INSTALL) -d $(PREFIX)/$$i/"; \
  127. $(INSTALL) -d $(PREFIX)/$$i/; \
  128. done
  129. @for i in $(MAN3); do \
  130. echo $(INSTALL) -m 0444 $$i $(PREFIX)/man/man3/; \
  131. $(INSTALL) -m 0444 $$i $(PREFIX)/man/man3/; \
  132. done
  133. @f=; \
  134. for i in $(MAN3_LINKS) ""; do \
  135. if test -z "$$f" ; then \
  136. f=$$i; \
  137. else \
  138. echo "rm -f $(PREFIX)/man/man3/$$i"; \
  139. rm -f $(PREFIX)/man/man3/$$i; \
  140. echo "ln -s $$f $(PREFIX)/man/man3/$$i"; \
  141. ln -s $$f $(PREFIX)/man/man3/$$i; \
  142. f=; \
  143. fi; \
  144. done
  145. @for i in $(MAN5); do\
  146. echo $(INSTALL) -m 0444 $$i $(PREFIX)/man/man5/; \
  147. $(INSTALL) -m 0444 $$i $(PREFIX)/man/man5/; \
  148. done
  149. clean :
  150. rm -f $(AGCSRCS) $(BGCSRCS) $(AGHDRS) $(BGHDRS) $(LIB_A) $(LIB_S)
  151. rm -f $(BGCSRCS:.c=.o_a) $(CCSRCS:.c=.o_a)
  152. rm -f $(BGCSRCS:.c=.o_s) $(CCSRCS:.c=.o_s)
  153. rm -f $(TCSRCS:.c=.o) $(TEST)
  154. rm -f *.s *.i
  155. distclean : clean
  156. rm -f config.cache config.log config.status config.h makelist Makefile
  157. #
  158. # Internal targets and rules.
  159. #
  160. $(LIB_A) : $(BGCSRCS:.c=.o_a) $(CCSRCS:.c=.o_a)
  161. $(AR) cr $@ $?
  162. $(RANLIB) $@
  163. $(LIB_S) : $(BGCSRCS:.c=.o_s) $(CCSRCS:.c=.o_s)
  164. $(CC) $(S_LDFLAGS) -o $@ $(BGCSRCS:.c=.o_s) $(CCSRCS:.c=.o_s) $(LIBS)
  165. $(TEST) : $(TCSRCS:.c=.o) $(LIB_A)
  166. $(CC) -o $@ $(TCSRCS:.c=.o) $(LIB_A) $(LIBS)
  167. common.h : common.c
  168. $(SHELL) makelist -h common.c > $@
  169. emacs.h : emacs.c
  170. $(SHELL) makelist -h emacs.c> $@
  171. vi.h : vi.c
  172. $(SHELL) makelist -h vi.c > $@
  173. fcns.h : $(AGHDRS)
  174. $(SHELL) makelist -fh $(AGHDRS) > $@
  175. fcns.c : $(AGHDRS) fcns.h
  176. $(SHELL) makelist -fc $(AGHDRS) > $@
  177. $(cyg_subst_sys)
  178. help.h : $(ACSRCS)
  179. $(SHELL) makelist -bh $(ACSRCS) > $@
  180. help.c : $(ACSRCS) help.h
  181. $(SHELL) makelist -bc $(ACSRCS) > $@
  182. $(cyg_subst_sys)
  183. editline.c : $(ACSRCS) $(BCSRCS) $(AGCSRCS)
  184. $(SHELL) makelist -e $(ACSRCS) $(BCSRCS) $(AGCSRCS) > $@
  185. .c.o :
  186. $(CC) -c $(A_CFLAGS) $(CFLAGS) $(CPPFLAGS) $< -o $@
  187. .c.o_a : $(AGHDRS) $(BGHDRS)
  188. $(CC) -c $(A_CFLAGS) $(CFLAGS) $(CPPFLAGS) $< -o $@
  189. .c.o_s : $(AGHDRS) $(BGHDRS)
  190. $(CC) -c $(S_CFLAGS) $(CFLAGS) $(CPPFLAGS) $< -o $@
  191. $(CCSRCS) : $(BGHDRS)