-#
-# Makefile - toplevel makefile that builds everything
-#
-# This file is part of the GNU PIC Library.
-#
-# January, 2004
-# The GNU PIC Library is maintained by,
-# Vangelis Rokas <vrokas@otenet.gr>
-#
-# $Id$
-#
-#
+###########################################################
+### Makefile for the GNU PIC Library
+###
+### Copyright (C) 2005 by Raphael Neider <rneider@web.de>
+###
+### The GNU PIC Library was originally designed and
+### implemented by
+### Vangelis Rokas <vrokas@otenet.gr>
+###
+### It is currently maintained by
+### Raphael Neider <rneider@web.de>
+###
+### This file may be distributed under the terms of the the
+### GNU General Public License (GPL). See COPYING for details.
+###
+### $Id$
+###
+topsrcdir = .
-include ./Makefile.common
+include $(topsrcdir)/Makefile.common
+ifeq (:,$(findstring :,$(LD) $(AS) $(LIB)))
-DIRS = libdev \
- libsdcc \
- libc \
- startup \
- debug
+.PHONY : all
+all % :
+ @echo "gputils not found -- PIC16 library not built!"
-all: build-all-libraries
+else
-build-all-libraries:
- @for temp in $(DIRS) ; do \
- $(MAKE) -C $$temp MODELFLAGS=$(MODELFLAGS) ; \
- done
+SUBDIRS = debug libc libdev libio libm libsdcc startup
+builddir = build
+installdir = bin
+export installdir
+C_SRC = $(wildcard *.c)
+S_SRC = $(wildcard *.S)
+OBJS = $(C_SRC:.c=.o) $(S_SRC:.S=.o)
-clean: all-clean
- $(RM) -f bin/*.*
+.PHONY : all clean clean-intermediate install
+all : install
+install : recurse
-all-clean:
- @for temp in $(DIRS) ; do \
- $(MAKE) -C $$temp clean ; \
- done
+clean : recurse
+ $(Q)-$(RMDIR) "$(topsrcdir)/$(builddir)";
-clean-intermediate:
- @for temp in $(DIRS) ; do \
- $(MAKE) -C $$temp clean-intermediate ; \
- done
+clean-intermediate : recurse
+include $(topsrcdir)/Makefile.rules
-dep: all-dep
-
-all-dep:
- for temp in $(DIRS) ; do \
- $(MAKE) -C $$temp dep ; \
- done
+endif