1# ***************************************************************************** 2# * Copyright (c) 2004, 2008 IBM Corporation 3# * All rights reserved. 4# * This program and the accompanying materials 5# * are made available under the terms of the BSD License 6# * which accompanies this distribution, and is available at 7# * http://www.opensource.org/licenses/bsd-license.php 8# * 9# * Contributors: 10# * IBM Corporation - initial implementation 11# ****************************************************************************/ 12 13TOPCMNDIR ?= ../.. 14 15LIBCCMNDIR = $(shell pwd) 16STRINGCMNDIR = $(LIBCCMNDIR)/string 17CTYPECMNDIR = $(LIBCCMNDIR)/ctype 18STDLIBCMNDIR = $(LIBCCMNDIR)/stdlib 19STDIOCMNDIR = $(LIBCCMNDIR)/stdio 20GETOPTCMNDIR = $(LIBCCMNDIR)/getopt 21 22include $(TOPCMNDIR)/make.rules 23 24 25CPPFLAGS = -I$(LIBCCMNDIR)/include 26LDFLAGS= -nostdlib 27 28TARGET = ../libc.a 29 30 31all: $(TARGET) 32 33# Use the following target to build a native version of the lib 34# (for example for debugging purposes): 35native: 36 $(MAKE) CROSS="" CC=$(HOSTCC) NATIVEBUILD=1 37 38 39include $(STRINGCMNDIR)/Makefile.inc 40include $(CTYPECMNDIR)/Makefile.inc 41include $(STDLIBCMNDIR)/Makefile.inc 42include $(STDIOCMNDIR)/Makefile.inc 43include $(GETOPTCMNDIR)/Makefile.inc 44 45OBJS = $(STRING_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDIO_OBJS) $(GETOPT_OBJS) 46 47ifneq ($(NATIVEBUILD),1) 48# These parts of the libc use assembler, so they can only be compiled when 49# we are _not_ building a native version. 50endif 51 52 53$(TARGET): $(OBJS) 54 $(AR) -rc $@ $(OBJS) 55 $(RANLIB) $@ 56 57 58clean: 59 $(RM) $(TARGET) $(OBJS) 60 61distclean: clean 62