Makefile.in 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. # Makefile for file(1) cmd.
  2. # Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
  3. # @(#)$Id: Makefile.in,v 1.5 1998/09/12 13:17:52 christos Exp $
  4. #
  5. # This software is not subject to any license of the American Telephone
  6. # and Telegraph Company or of the Regents of the University of California.
  7. #
  8. # Permission is granted to anyone to use this software for any purpose on
  9. # any computer system, and to alter it and redistribute it freely, subject
  10. # to the following restrictions:
  11. #
  12. # 1. The author is not responsible for the consequences of use of this
  13. # software, no matter how awful, even if they arise from flaws in it.
  14. #
  15. # 2. The origin of this software must not be misrepresented, either by
  16. # explicit claim or by omission. Since few users ever read sources,
  17. # credits must appear in the documentation.
  18. #
  19. # 3. Altered versions must be plainly marked as such, and must not be
  20. # misrepresented as being the original software. Since few users
  21. # ever read sources, credits must appear in the documentation.
  22. #
  23. # 4. This notice may not be removed or altered.
  24. VERSION = 3.26
  25. SHELL = /bin/sh
  26. #MAGIC = /etc/magic
  27. prefix = @prefix@
  28. INSTALLCMD = @INSTALL@
  29. INSTALL_DATA = @INSTALL_DATA@
  30. MAGICDIR = @datadir@/misc
  31. MAGIC = $(MAGICDIR)/magic
  32. LOCALMAGIC = $(DESTDIR)/etc/magic
  33. DEFS = -DMAGIC='"$(LOCALMAGIC):$(MAGIC)"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H
  34. CPPFLAGS = $(DEFS)
  35. CC = @CC@
  36. #COPTS = -O -g # newer compilers allow both; else drop -O
  37. # For truly antique environments, use this for (dummy) include files:
  38. #COPTS = -O # -Ilocalinc
  39. #CFLAGS = $(COPTS) $(DEFS)
  40. CFLAGS = -I. @CFLAGS@
  41. #LDFLAGS = $(COPTS) # -Bstatic # older gdb couldn't handle shared libs
  42. SHAR = bundle
  43. OFILE = /usr/bin/file # old or distributed version, for comparison
  44. # Where new binary lives; typically /usr/local (BSD), /usr/lbin (USG).
  45. BINDIR = @exec_prefix@/bin
  46. # For installing our man pages;
  47. # MANCxxx is manual section for Commands, MANFxxx is section for file formats.
  48. # MANxDIR is directory names; MANxEXT is the filename extention. Usual values:
  49. # Variable V7 4BSD Sys V
  50. # MANCDIR /usr/man/man1 /usr/man/man1 /usr/man/u_man/man1
  51. # MANFDIR /usr/man/man5 /usr/man/man5 /usr/man/u_man/man4
  52. # MANCEXT 1 1 1
  53. # MANFEXT 5 5 4
  54. # --- possible alternative for 4BSD ---
  55. # MANCDIR /usr/local/man/man1
  56. # MANCEXT 1
  57. # or
  58. # MANCDIR /usr/man/manl
  59. # MANCEXT l
  60. # --- possible alternative for USG ---
  61. # MANCDIR /usr/man/local/man1
  62. # MANCEXT 1
  63. MANCDIR = @mandir@/man1
  64. MANCEXT = 1
  65. MANFDIR = @mandir@/man5
  66. MANFEXT = 5
  67. # There are no system-dependant configuration options (except maybe CFLAGS).
  68. # Uncomment any of these that is missing from your "standard" library.
  69. LOCALSRCS = # localsrc/getopt.c localsrc/strtol.c \
  70. # localsrc/strtok.c localsrc/strchr.c
  71. LOCALOBJS = # localsrc/getopt.o localsrc/strtol.o \
  72. # localsrc/strtok.o localsrc/strchr.o
  73. # These are not compiled in unless you use -Ilocalinc, but
  74. # are not commented out as "make dist" &c use them.
  75. LOCALINC = # localinc/*.h localinc/sys/*.h
  76. SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
  77. compress.c is_tar.c readelf.c internat.c \
  78. print.c $(LOCALSRCS) $(LOCALINC)
  79. OBJS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o \
  80. compress.o is_tar.o readelf.o internat.o \
  81. print.o $(LOCALOBJS)
  82. HDRS = file.h names.h patchlevel.h readelf.h tar.h
  83. AUTOSRC=configure configure.in install-sh config.h.in Makefile.in
  84. ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) $(HDRS) \
  85. Makefile.std file.man magic.man magic2mime $(AUTOSRC) \
  86. Localstuff Header
  87. ALLMAGIC = Magdir/[a-z]*
  88. all: file magic file.${MANCEXT} magic.${MANFEXT}
  89. TESTFILES = * tst/*
  90. try: all $(OFILE)
  91. cd tst; $(MAKE)
  92. time $(OFILE) $(TESTFILES) >/tmp/t1 # can't use ./magic
  93. time ./file -m ./magic $(TESTFILES) >/tmp/t2
  94. -diff -b /tmp/t[12]
  95. what ./file >lastnocore
  96. file: $(OBJS)
  97. $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
  98. lint: $(SRCS)
  99. lint -ha $(DEFS) $(SRCS) | tee $@
  100. magic: Header Localstuff Magdir
  101. cat Header Localstuff Magdir/[a-z]* > $@
  102. ascmagic.o: names.h
  103. compress.o apprentice.o ascmagic.o file.o fsmagic.o print.o softmagic.o: file.h
  104. install: file magic
  105. mkdir -p $(BINDIR) $(MAGICDIR) $(MANCDIR) $(MANFDIR)
  106. $(INSTALLCMD) file magic2mime $(BINDIR)
  107. $(INSTALL_DATA) magic $(MAGIC)
  108. $(INSTALL_DATA) magic.local $(LOCALMAGIC)
  109. $(INSTALL_DATA) file.${MANCEXT} $(MANCDIR)/file.$(MANCEXT)
  110. $(INSTALL_DATA) magic.${MANFEXT} $(MANFDIR)/magic.$(MANFEXT)
  111. install.man: file.${MANCEXT} magic.${MANFEXT}
  112. cp file.${MANCEXT} $(MANCDIR)/file.$(MANCEXT)
  113. cp magic.${MANFEXT} $(MANFDIR)/magic.$(MANFEXT)
  114. clean:
  115. rm -f *.o core file magic lint dist.* MANIFEST \
  116. magic.${MANFEXT} file.${MANCEXT} \
  117. config.h config.status config.cache config.log
  118. clobber:
  119. cd tst; $(MAKE) clean
  120. magic.${MANFEXT} : Makefile magic.man
  121. @rm -f $@
  122. sed -e s@__CSECTION__@${MANCEXT}@g \
  123. -e s@__FSECTION__@${MANFEXT}@g \
  124. -e s@__VERSION__@${VERSION}@g \
  125. -e s@__MAGIC__@${MAGIC}@g magic.man > $@
  126. touch --reference=magic.man $@
  127. file.${MANCEXT} : Makefile file.man
  128. @rm -f $@
  129. sed -e s@__CSECTION__@${MANCEXT}@g \
  130. -e s@__FSECTION__@${MANFEXT}@g \
  131. -e s@__VERSION__@${VERSION}@g \
  132. -e s@__MAGIC__@${MAGIC}@g file.man > $@
  133. touch --reference=file.man $@
  134. send: dist
  135. ftp ftp.cs
  136. dist: dist.src dist.magic
  137. @echo Now check this patchlevel!
  138. ident patchlevel.h
  139. dist.src: $(ALLSRC) MANIFEST
  140. # Some versions of shar can't handle a single file from
  141. # a subdirectory, so we manually insert mkdir as needed.
  142. # The point is to exclude all the generable targets in tst.
  143. (echo mkdir localinc localinc/sys localsrc tst; \
  144. $(SHAR) $(ALLSRC) MANIFEST) > $@
  145. rcsdiff: $(ALLSRC)
  146. rcsdiff -q RCS/*
  147. MANIFEST: $(ALLSRC)
  148. ident $(ALLSRC) > MANIFEST
  149. dist.magic: Magdir
  150. # As above, but to exclude Magdir/RCS from being shipped.
  151. (echo mkdir Magdir; $(SHAR) $(ALLMAGIC)) >$@
  152. tar: $(ALLSRC) $(ALLMAGIC)
  153. -rm -fr file-${VERSION}
  154. -mkdir file-${VERSION} file-${VERSION}/Magdir
  155. ln $(ALLSRC) file-${VERSION}
  156. ln ${ALLMAGIC} file-${VERSION}/Magdir
  157. tar cvf file-${VERSION}.tar file-${VERSION}
  158. -rm -fr file-${VERSION}