# libstd-public-makefile : Makefile fragment for compiling a target-specific version of libstd
# Copyright (c) 2005-2007 Garth Zeglin

# This file is part of ArtLPC. 

# ArtLPC 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 2 of the License, or
# (at your option) any later version.

# ArtLPC 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 ArtLPC; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

# ---------------------------------------------------------------------
# Makefile entries for creating a custom libstd.  Since the library
# must be compiled in the context of a config.h customization file,
# this file should be included in a project Makefile with appropriate
# vpath settings, and the source compiled in the project directory.

# Just as the C source is controlled by config.h, this Makefile
# fragment inherits settings from the including Makefile.

# By default, compile for the target (the most limited environment).

ifndef LIBSTD_INCLUDE_UNIX_SOURCE
LIBSTD_INCLUDE_UNIX_SOURCE = false
endif

ifneq '$(LIBSTD_INCLUDE_UNIX_SOURCE)' 'false'
LIBSTD_UNIX_SRCS = \
#	file_port.c \
#	mmap_block_device.c
else
LIBSTD_UNIX_SRCS = \
	libc.c
endif

LIBSTD_C_SRCS = \
	fixed_point.c \
	format.c \
	memalloc.c \
	port.c \
	standard_ports.c \
	current_ports.c \
	string_port.c \
	null_port.c \

LIBSTD_ASM_SRCS = \

LIBSTD_OBJS = $(LIBSTD_C_SRCS:%.c=%.o) $(LIBSTD_UNIX_SRCS:%.c=%.o) $(LIBSTD_ASM_SRCS:%.S=%.o)

$(LIBOBJDIR)/libstd.a: $(LIBSTD_OBJS:%=$(LIBOBJDIR)/%)
	$(AR) cru $@ $^
	$(RANLIB) $@

