#   Mega2: Manipulation Environment for Genetic Analysis
#   Copyright (C) 1999-2014 Robert Baron, Charles P. Kollar,
#   Nandita Mukhopadhyay, Lee Almasy, Mark Schroeder, William P. Mulvihill,
#   Daniel E. Weeks, and University of Pittsburgh
#  
#   This file is part of the Mega2 program, which is free software; you
#   can redistribute it and/or modify it under the terms of the GNU
#   General Public License as published by the Free Software Foundation;
#   either version 3 of the License, or (at your option) any later
#   version.
#  
#   Mega2 is distributed in the hope that it will be useful, but WITHOUT
#   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
#   for more details.
#  
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#  
#   For further information contact:
#       Daniel E. Weeks
#       e-mail: weeks@pitt.edu
# 
# ===========================================================================
# Makefile for VCFTOOLS as a library for Mega2
# Requires gnu make (sometimes called 'gmake')
#

# NOTE: the '-DNDEBUG' is needed to turn off the assert macros in the VCFtools code...
LOCFLAGS += -DNDEBUG

# Put the library in the Mega2 srcdir above this...
# NOTE: -lz is needed when the library is linked...
ifeq ($(OSTYPE),windows)
UP = ..\\
WINO = -Fo$*.o
else
UP = ../
WINO = 
endif

OUT = $(UP)libvcftools.a

# source files.
SRC =  	mega2_vcftools_interface.cpp \
	parameters.cpp header.cpp \
	entry.cpp entry_getters.cpp entry_setters.cpp bcf_entry.cpp bcf_entry_setters.cpp \
	vcf_entry.cpp vcf_entry_setters.cpp \
	variant_file.cpp variant_file_filters.cpp variant_file_index.cpp bcf_file.cpp vcf_file.cpp

OBJ = $(SRC:.cpp=.o)

# include directories '.' for other vcftools headers, '..' for Mega2 headers... and zlib headers
LOCFLAGS += -I..

# CC, CFLAGS are defined in Mega2 Makedefs

.SUFFIXES: .cpp

default: $(OUT)

.cpp.o:
	$(CXX) $(INCLUDES) $(CFLAGS) $(LOCFLAGS) -c $< $(WINO)

.c.o:
	$(CC) $(INCLUDES) $(CFLAGS) $(LOCFLAGS) -c $< $(WINO)

bgzf: bgzf.c bgzf.h

$(OUT): $(OBJ) bgzf.o
	$(AR) $(ARFLAGS) $(AROUT)$(OUT) $(OBJ) bgzf.o

depend:
	makedepend -Y. -- $(CFLAGS) $(LOCFLAGS) -- $(INCLUDES) $(SRC) bgzf.c

clean:
	$(RM) $(OBJ) bgzf.o $(OUT) Makefile.bak

distclean: clean


# DO NOT DELETE

mega2_vcftools_interface.o: ../common.h ../typedefs.h ../errorno.h
mega2_vcftools_interface.o: ../allutil.h ../linkage.h ../linkage_external.h
mega2_vcftools_interface.o: ../makeped.h ../pedtree.h ../analysis.h
mega2_vcftools_interface.o: ../analysis_ext.h ../write_fbat_ext.h
mega2_vcftools_interface.o: ../write_plink_ext.h ../plink_core_ext.h
mega2_vcftools_interface.o: ../write_eigenstrat_ext.h ../write_pangaea_ext.h
mega2_vcftools_interface.o: ../write_beagle_ext.h ../write_structure_ext.h
mega2_vcftools_interface.o: ../write_pseq_ext.h ../batch_input.h
mega2_vcftools_interface.o: ../input_check.h ../hwe.h ../compress_ext.h
mega2_vcftools_interface.o: ../utils_ext.h ../genetic_utils_ext.h
mega2_vcftools_interface.o: ../error_messages_ext.h ../annotated_ped_file.h
mega2_vcftools_interface.o: ../read_files_ext.h ../marker_lookup_ext.h
mega2_vcftools_interface.o: ../phe_lookup_ext.h output_log.h parameters.h
mega2_vcftools_interface.o: variant_file.h ../zlib.h ../zconf.h entry.h
mega2_vcftools_interface.o: bgzf.h vcf_entry.h bcf_entry.h header.h
mega2_vcftools_interface.o: bcf_file.h vcf_file.h mega2_vcftools_interface.h
mega2_vcftools_interface.o: ../annotated_ped_file.h
parameters.o: parameters.h output_log.h
header.o: header.h entry.h bgzf.h ../zlib.h ../zconf.h output_log.h
entry.o: entry.h bgzf.h ../zlib.h ../zconf.h output_log.h
entry_getters.o: entry.h bgzf.h ../zlib.h ../zconf.h output_log.h
entry_setters.o: entry.h bgzf.h ../zlib.h ../zconf.h output_log.h
bcf_entry.o: bcf_entry.h output_log.h entry.h bgzf.h ../zlib.h ../zconf.h
bcf_entry.o: header.h
bcf_entry_setters.o: bcf_entry.h output_log.h entry.h bgzf.h ../zlib.h
bcf_entry_setters.o: ../zconf.h header.h
vcf_entry.o: vcf_entry.h entry.h bgzf.h ../zlib.h ../zconf.h output_log.h
vcf_entry_setters.o: vcf_entry.h entry.h bgzf.h ../zlib.h ../zconf.h
vcf_entry_setters.o: output_log.h
variant_file.o: variant_file.h ../zlib.h ../zconf.h parameters.h output_log.h
variant_file.o: entry.h bgzf.h vcf_entry.h bcf_entry.h header.h
variant_file_filters.o: variant_file.h ../zlib.h ../zconf.h parameters.h
variant_file_filters.o: output_log.h entry.h bgzf.h vcf_entry.h bcf_entry.h
variant_file_filters.o: header.h
variant_file_index.o: variant_file.h ../zlib.h ../zconf.h parameters.h
variant_file_index.o: output_log.h entry.h bgzf.h vcf_entry.h bcf_entry.h
variant_file_index.o: header.h
bcf_file.o: bcf_file.h output_log.h parameters.h variant_file.h ../zlib.h
bcf_file.o: ../zconf.h entry.h bgzf.h vcf_entry.h bcf_entry.h header.h
vcf_file.o: vcf_file.h output_log.h vcf_entry.h entry.h bgzf.h ../zlib.h
vcf_file.o: ../zconf.h parameters.h variant_file.h bcf_entry.h header.h
bgzf.o: bgzf.h ../zlib.h ../zconf.h
