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/bzip2 30 31include $(TOP)/build/Makefile.env 32 33INT_LIBS = \ 34 libbz2 35 36ALL_LIBS = \ 37 $(INT_LIBS) 38 39OBJFILES = \ 40 $(LIBBZ2_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)/libbz2 57 58.PHONY: $(TARGDIR)/all 59 60#------------------------------------------------------------------------------- 61# std 62# 63$(TARGDIR)/std: $(ILIBDIR)/libbz2 64 65.PHONY: $(TARGDIR)/std 66 67#------------------------------------------------------------------------------- 68# clean 69# 70clean: stdclean 71 @ rm -f libbz2.vers 72 73.PHONY: clean 74 75#------------------------------------------------------------------------------- 76# libbz2 77# 78$(ILIBDIR)/libbz2: $(addprefix $(ILIBDIR)/libbz2.,$(LIBX)) 79 80LIBBZ2_SRC = \ 81 blocksort \ 82 huffman \ 83 crctable \ 84 randtable \ 85 compress \ 86 decompress \ 87 bzlib 88 89LIBBZ2_OBJ = \ 90 $(addsuffix .$(LOBX),$(LIBBZ2_SRC)) 91 92$(ILIBDIR)/libbz2.$(LIBX): $(LIBBZ2_OBJ) 93 $(LD) --slib -o $@ $^ $(LIBBZ2_LIB) 94 95 96#------------------------------------------------------------------------------- 97# libbz2 download 98# 99BZIP2_VERS := \ 100 1.0.6 101 102BZIP2_TAR = \ 103 bzip2-$(BZIP2_VERS).tar 104 105BZIP2_TAR_GZ = \ 106 $(BZIP2_TAR).gz 107 108ifeq (win,$(OS)) 109ECHO_VERS = echo -ne $(BZIP2_VERS) "\n" 110CFLAGS := $(CFLAGS) -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE 111else 112ECHO_VERS = echo $(BZIP2_VERS) 113endif 114 115ifeq (sun,$(OS)) 116 BZIP2_TAR_GET = $(BZIP2_TAR) 117 TAR_CMD = tar -xf 118else 119 BZIP2_TAR_GET = $(BZIP2_TAR_GZ) 120 TAR_CMD = tar --no-same-owner -x -z -f 121endif 122 123ifeq (mac,$(OS)) 124RETRIEVE = curl -O 125else 126RETRIEVE = wget 127endif 128 129$(BZIP2_TAR_GZ): 130 @ echo downloading the sources 131 $(RETRIEVE) http://bzip.org/$(BZIP2_VERS)/bzip2-$(BZIP2_VERS).tar.gz 132 @ touch $@ 133 134$(BZIP2_TAR): $(BZIP2_TAR_GZ) 135 gzcat $^ > $@ 136 137libbz2.vers: $(BZIP2_TAR_GET) 138 @ echo unpacking the sources 139 $(TAR_CMD) $^ 140 cp bzip2-$(BZIP2_VERS)/*.[ch] . 141 cp bzip2-$(BZIP2_VERS)/*.def . 142 #-rm -rf bzip2-$(BZIP2_VERS) 143ifeq (1.0.6,$(BZIP2_VERS)) 144 patch < bzip2-1.0.6.diff 145endif 146 @ $(ECHO_VERS) > $@ 147 148download: libbz2.vers 149 150.PHONY: download 151 152compile: stdcompile 153 154$(TARGDIR)/compile: $(OBJFILES) 155 156#------------------------------------------------------------------------------- 157# fuzz 158# 159fuzz: std 160 cp $(addsuffix .$(LIBX),$(addprefix $(ILIBDIR)/,$(INT_LIBS))) $(FLIBDIR)/ 161