# 
#     Copyright (c) 2017, NVIDIA CORPORATION.  All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# 

# This makefile can be used to build pgzip, pgunzip, and pgextract.
# These utilities use the zlib general purpose compression library
# written by Jean-loup Gailly and Mark Adler.  pgzip and pgunzip,
# in particular, are based on the excellent and well-documented
# zpipe.c example Version 1.2 (November 2004) written by Mark Adler.
# See www.zlib.net for more information on zlib.
#
# pgextract can be built without zlib decompression.
#
# Currently, you need to set a default object file type when building
# pgextract, by defining one of TARGET_ELF, TARGET_MSCOFF or TARGET_MACHO
#

CC=pgcc
CFLAGS=-O
DEFAULT_TARGET=TARGET_ELF
#DEFAULT_TARGET=TARGET_MSCOFF
#DEFAULT_TARGET=TARGET_MACHO

all: pgextract pgzip pgunzip

pgextract: pgextract.c elf_x.h macho_x.h
	$(CC) $(CFLAGS) -o pgextract -DZLIB -D$(DEFAULT_TARGET) pgextract.c -lz

pgextract_nozlib: pgextract.c elf_x.h macho_x.h
	$(CC) $(CFLAGS) -o pgextract_nozlib -D$(DEFAULT_TARGET) pgextract.c

pgzip: pgzip.c
	$(CC) $(CFLAGS) -o pgzip pgzip.c -lz

pgunzip: pgunzip.c
	$(CC) $(CFLAGS) -o pgunzip pgunzip.c -lz
