# ----------------------------------------------------------------------------
# - Makefile                                                                 -
# - acme src system make file - linux-arm makefile                           -
# ----------------------------------------------------------------------------
# - This program is  free software;  you can  redistribute it and/or  modify -
# - it provided that this copyright notice is kept intact.                   -
# -                                                                          -
# - This  program  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. In not event shall -
# - the copyright holder be  liable for  any direct, indirect, incidental or -
# - special damages arising in any way out of the use of this software.      -
# ----------------------------------------------------------------------------
# - copyright (c) 1999-2000 amaury darsch                                    -
# ----------------------------------------------------------------------------

TOPDIR		= ../../..
CNFDIR		= $(TOPDIR)/cnf
SITEFILE	= $(CNFDIR)/site.mak
RULEFILE	= $(CNFDIR)/rule.mak
include		  $(SITEFILE)

# ----------------------------------------------------------------------------
# source file generation                                                     -
# ----------------------------------------------------------------------------

ARLIB           = $(ASYSLIB)
SOLIB           = $(ARLIB:.a=.so)
TARGET          = $(ARLIB) $(SOLIB)
INCLUDE		= -I. -I../include

CXXGENERICS     = cio.cxx     \
                  cdl.cxx     \
		  cdir.cxx    \
                  csys.cxx    \
		  cmem.cxx    \
		  cterm.cxx   \
		  cmath.cxx   \
		  cstring.cxx \
		  cserial.cxx

CXXSPECIALS	= clinux.cxx

HXXSRCS		= $(wildcard ../include/*.hxx)
CXXSRCS		= $(CXXGENERICS) $(CXXSPECIALS)

# ----------------------------------------------------------------------------
# - project rules                                                            -
# ----------------------------------------------------------------------------

# rule: all
# this rule is the default rule which call the build rule

all: build
.PHONY: all

# include: rule.mak
# this rule includes the platform dependant rules

vpath 	%.cxx ../unix
include $(RULEFILE)

# rule: build
# build the standard object library (libasys)

build: $(TARGET)
	@$(MKDIR) $(ASYSINC)
	@cd ../include; for i in *.hxx; do \
	  $(CMP) $$i $(ASYSINC)/$$i || $(CP) $$i $(ASYSINC)/$$i; \
	done
.PHONY: build

# rule: libasys.a
# build the library archive

$(ARLIB): $(OBJECTS)
	$(AR) $@ $(OBJECTS)
	@$(MKDIR) $(LIBREL)
	@$(CP) $@ $(LIBREL)

# rule: libasys.so
# build the dynamic library

$(SOLIB).$(SOFILE): $(OBJECTS)
	$(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(STDLIBS)
	@$(MKDIR) $(LIBREL)
	@$(CP) $@ $(LIBREL)

# rule: install
# install the libraries and the include files

install: installib
	@$(MKDIR)         $(INCDIR)
	@$(CP) $(HXXSRCS) $(INCDIR)
.PHONY: install
