# Makefile for uClibc
#
# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#

UNISTD_DIR := $(top_srcdir)libc/unistd
UNISTD_OUT := $(top_builddir)libc/unistd

CSRC := $(notdir $(wildcard $(UNISTD_DIR)/*.c))
# multi source
CSRC := $(filter-out exec.c,$(CSRC))

ifeq ($(ARCH_HAS_MMU),y)
CSRC := $(filter-out __exec_alloc.c,$(CSRC))
else
CSRC := $(filter-out daemon.c,$(CSRC))
endif

ifeq ($(UCLIBC_HAS_GNU_GETOPT),y)
CSRC := $(filter-out getopt-susv3.c,$(CSRC))
else
CSRC := $(filter-out getopt.c,$(CSRC))
endif

ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
CSRC := $(filter-out sleep.c,$(CSRC))
endif

UNISTD_SRC := $(patsubst %.c,$(UNISTD_DIR)/%.c,$(CSRC))
UNISTD_OBJ := $(patsubst %.c,$(UNISTD_OUT)/%.o,$(CSRC))

libc-y += $(UNISTD_OBJ)

objclean-y += unistd_objclean

unistd_objclean:
	$(RM) $(UNISTD_OUT)/*.{o,os}