1# ===========================================================================
2#
3#                            PUBLIC DOMAIN NOTICE
4#               National Center for Biotechnology Information
5#
6#  This software/database is a "United States Government Work" under the
7#  terms of the United States Copyright Act.  It was written as part of
8#  the author's official duties as a United States Government employee and
9#  thus cannot be copyrighted.  This software/database is freely available
10#  to the public for use. The National Library of Medicine and the U.S.
11#  Government have not placed any restriction on its use or reproduction.
12#
13#  Although all reasonable efforts have been taken to ensure the accuracy
14#  and reliability of the software and data, the NLM and the U.S.
15#  Government do not and cannot warrant the performance or results that
16#  may be obtained by using this software or data. The NLM and the U.S.
17#  Government disclaim all warranties, express or implied, including
18#  warranties of performance, merchantability or fitness for any particular
19#  purpose.
20#
21#  Please cite the author in any work or product based on this material.
22#
23# ===========================================================================
24
25
26default: std
27
28TOP ?= $(abspath ../../..)
29MODULE = libs/ext/magic
30
31INT_LIBS = \
32    magic
33
34EXT_LIBS = \
35
36ALL_LIBS = \
37	$(INT_LIBS) \
38	$(EXT_LIBS)
39
40OBJFILES = \
41	$(LIBMAGIC_OBJ)
42
43include $(TOP)/build/Makefile.env
44
45#-------------------------------------------------------------------------------
46# outer targets
47#
48all std: makedirs compile # $(ALL_LIBS)
49	@ $(MAKE_CMD) $(TARGDIR)/$@
50
51$(INT_LIBS): makedirs
52	@ $(MAKE_CMD) $(ILIBDIR)/$@
53
54$(EXT_LIBS): makedirs
55	@ $(MAKE_CMD) $(LIBDIR)/$@
56
57.PHONY: all std $(ALL_LIBS)
58
59#-------------------------------------------------------------------------------
60# all
61#
62$(TARGDIR)/all: \
63	$(addprefix $(ILIBDIR)/,$(INT_LIBS)) \
64	$(addprefix $(LIBDIR)/,$(EXT_LIBS))
65
66.PHONY: $(TARGDIR)/all
67
68#-------------------------------------------------------------------------------
69# std
70#
71$(TARGDIR)/std: $(ILIBDIR)/magic
72
73.PHONY: $(TARGDIR)/std
74
75#-------------------------------------------------------------------------------
76# clean
77#
78clean: stdclean
79	@ rm -f $(ILIBDIR)/libmagic-static.$(LIBX)
80
81.PHONY: clean
82
83#-------------------------------------------------------------------------------
84# libmagic, version 5.04 (ftp://ftp.astron.com/pub/file/file-5.04.tar.gz) configured for 64 bit Linux
85#
86$(ILIBDIR)/magic:
87
88ifeq (linux,$(OS))
89ifeq (64,$(BITS))
90
91$(ILIBDIR)/magic: $(addprefix $(ILIBDIR)/$(LPFX)magic-static.,$(LIBX))
92
93CFLAGS += -DHAVE_CONFIG_H
94
95LIBMAGIC_SRC = \
96	magic \
97	apprentice \
98	softmagic \
99	ascmagic \
100	encoding \
101	compress \
102	is_tar \
103	readelf \
104	print \
105	fsmagic \
106	funcs \
107	apptype \
108	cdf \
109	cdf_time \
110	readcdf \
111    strlcat \
112    strlcpy \
113
114LIBMAGIC_OBJ = \
115	$(addsuffix .$(LOBX),$(LIBMAGIC_SRC))
116
117LIBMAGIC_LIB = \
118
119$(ILIBDIR)/libmagic-static.$(LIBX): $(LIBMAGIC_OBJ)
120	$(LD) --slib -o $@ $^ $(LIBMAGIC_LIB)
121
122endif
123endif
124
125compile: stdcompile
126
127$(TARGDIR)/compile: $(OBJFILES)
128