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/zlib 30 31include $(TOP)/build/Makefile.env 32 33INT_LIBS = \ 34 libz 35 36ALL_LIBS = \ 37 $(INT_LIBS) 38 39OBJFILES = \ 40 $(LIBZ_OBJ) 41 42#------------------------------------------------------------------------------- 43# outer targets 44# 45std all: makedirs compile # download 46 @ $(MAKE_CMD) $(TARGDIR)/$@ 47 48$(INT_LIBS): makedirs # download 49 @ $(MAKE_CMD) $(ILIBDIR)/$@ 50 51.PHONY: all std $(ALL_LIBS) 52 53#------------------------------------------------------------------------------- 54# all 55# 56$(TARGDIR)/all: $(ILIBDIR)/libz 57 58.PHONY: $(TARGDIR)/all 59 60#------------------------------------------------------------------------------- 61# std 62# 63$(TARGDIR)/std: $(ILIBDIR)/libz 64 65.PHONY: $(TARGDIR)/std 66 67#------------------------------------------------------------------------------- 68# clean 69# 70clean: stdclean 71 72.PHONY: clean 73 74#------------------------------------------------------------------------------- 75# libz 76# 77$(ILIBDIR)/libz: $(addprefix $(ILIBDIR)/libz.,$(LIBX)) 78 79LIBZ_SRC = \ 80 adler32 \ 81 compress \ 82 crc32 \ 83 deflate \ 84 gzclose \ 85 gzlib \ 86 gzread \ 87 gzwrite \ 88 infback \ 89 inffast \ 90 inflate \ 91 inftrees \ 92 trees \ 93 uncompr \ 94 zutil 95 96 97LIBZ_OBJ = \ 98 $(addsuffix .$(LOBX),$(LIBZ_SRC)) 99 100$(ILIBDIR)/libz.$(LIBX): $(LIBZ_OBJ) 101 $(LD) --slib -o $@ $^ $(LIBZ_LIB) 102 103 104#------------------------------------------------------------------------------- 105# libz download 106# 107ZLIB_VERS := \ 108 1.2.11 109 110ZLIB_TAR = \ 111 zlib-$(ZLIB_VERS).tar 112 113ZLIB_TAR_GZ = \ 114 $(ZLIB_TAR).gz 115 116ifeq (win,$(OS)) 117ECHO_VERS = echo -ne $(ZLIB_VERS) "\n" 118CFLAGS := $(CFLAGS) -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE 119else 120ECHO_VERS = echo $(ZLIB_VERS) 121endif 122 123ifeq (sun,$(OS)) 124 ZLIB_TAR_GET = $(ZLIB_TAR) 125 TAR_CMD = tar -xf 126else 127 ZLIB_TAR_GET = $(ZLIB_TAR_GZ) 128 TAR_CMD = tar --no-same-owner -x -z -f 129endif 130 131ifeq (mac,$(OS)) 132RETRIEVE = curl -O 133else 134RETRIEVE = wget 135endif 136 137$(ZLIB_TAR_GZ): 138 @ echo downloading the sources 139 $(RETRIEVE) http://zlib.net/$@ 140 @ touch $@ 141 142$(ZLIB_TAR): $(ZLIB_TAR_GZ) 143 gzcat $^ > $@ 144 145libz.vers: $(ZLIB_TAR_GET) 146 @ echo unpacking the sources 147 $(TAR_CMD) $^ 148 cp zlib-$(ZLIB_VERS)/*.[ch] . 149 cp zlib-$(ZLIB_VERS)/win32/zlib.def libz.def 150ifeq (1.2.8,$(ZLIB_VERS)) 151 patch < zlib-1.2.8.diff 152endif 153 @ $(ECHO_VERS) > $@ 154 155download: libz.vers 156 157.PHONY: download 158 159 160compile: stdcompile 161 162$(TARGDIR)/compile: $(OBJFILES) 163 164#------------------------------------------------------------------------------- 165# fuzz 166# 167fuzz: std 168 cp $(addsuffix .$(LIBX),$(addprefix $(ILIBDIR)/,$(INT_LIBS))) $(FLIBDIR)/ 169