#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2010 Jrg Schilling, Inc.  All rights reserved.
# Use is subject to license terms.
#

PROG =		star
ROOTFS_PROG =	$(PROG)

OBJS=		star.o header.o cpiohdr.o xheader.o xattr.o \
		list.o extract.o create.o append.o diff.o restore.o \
		remove.o star_unix.o acl_unix.o acltext.o fflags.o \
		buffer.o dirtime.o lhash.o \
		hole.o longnames.o \
		movearch.o table.o props.o \
		unicode.o \
		subst.o volhdr.o \
		chdir.o match.o defaults.o dumpdate.o \
		fifo.o device.o checkerr.o \
		findinfo.o

SRCS=	$(OBJS:%.o=%.c)

include ../Makefile.cmd

#CFLAGS += something

#
# for message cataloge
#
POFILE= star.po
POFILES= $(SRCS:%.c=%.po)
XGETFLAGS += -a -x star.xcl

CPPFLAGS +=	-D__STAR__
CPPFLAGS +=	-DSET_CTIME -DFIFO -DUSE_MMAP -DUSE_REMOTE -DUSE_RCMD_RSH
#CPPFLAGS +=	-DSET_CTIME -DFIFO -DUSE_MMAP
#CPPFLAGS +=	-DSET_CTIME -DUSE_MMAP
#CPPFLAGS +=	-DFIFO -DUSE_MMAP
CPPFLAGS +=	-DUSE_LARGEFILES
CPPFLAGS +=	-DUSE_FIND
CPPFLAGS +=	-DUSE_ACL
CPPFLAGS +=	-DUSE_XATTR
CPPFLAGS +=	-DUSE_FFLAGS
CPPFLAGS +=	-DCOPY_LINKS_DELAYED
CPPFLAGS +=	-DSTAR_FAT
CPPFLAGS +=	-DSCHILY_PRINT
CPPFLAGS +=	-DNO_PRINTFLIKE=1


#MAPFILES = $(MAPFILE.INT) $(MAPFILE.NGB)
#LDFLAGS += $(MAPFILES:%=-M%)
LDLIBS += -ldeflt -lrmt -lfind -lschily -lsec -lsocket -lnsl

.KEEP_STATE:

.PARALLEL:	$(OBJS)

all: $(ROOTFS_PROG)

$(PROG): $(OBJS) $(MAPFILES)
	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
	$(POST_PROCESS)

$(POFILE): $(POFILES)
	$(RM) $@
	$(CAT)     $(POFILES) > $@

install: all $(ROOTPROG)
	$(RM) $(ROOTBIN)/ustar
	$(SYMLINK) star $(ROOTBIN)/ustar
	$(RM) $(ROOTBIN)/suntar
	$(SYMLINK) star $(ROOTBIN)/suntar
	$(RM) $(ROOTBIN)/gnutar
	$(SYMLINK) star $(ROOTBIN)/gnutar
	$(RM) $(ROOTBIN)/spax
	$(SYMLINK) star $(ROOTBIN)/spax
	$(RM) $(ROOTBIN)/scpio
	$(SYMLINK) star $(ROOTBIN)/scpio

clean:	
	$(RM) $(OBJS)

lint: lint_SRCS

include ../Makefile.targ
