# -----------------------------------------------------------------------------
#	Makefile system to maintain several drivers. 
# -----------------------------------------------------------------------------
#
#	Copyright (C) 1995 by Steffen Seeger, [seeger@physik.tu-chemnitz.de]
#
# -----------------------------------------------------------------------------
#
#	This program 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, or (at your option)
#	any later version.
#
#	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.  See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program; see the file COPYING.  If not, write to
#	the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
# ----------------------------------------------------------------------------

ifeq (.config, ($wildcard .config))
include .config
else
.config:
	configure
	echo Making ...; make depend; echo
endif

SUBDIRS = ramdac chipset clock monitor kernel
DEBUGFLAGS = -DDEBUG
MAKEFLAGS = --no-print-directory --silent

%.o: %.c
.PHONY: scrdrv all monitor/mondrv.o ramdac/dacdrv.o chipset/chipdrv.o\
        clock/clockdrv.o kernel/driver.o config

scrdrv:  scrdrv.o
	echo

config:
	configure

oldconfig: .config.old
	cp -f .config.old .config

.config.old:
	@echo There is no .config.old file. Type 'make config' instead.; exit -1

all:
	@set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i all; done
	@$(MAKE) scrdrv	

scrdrv.o: kernel/driver.o ramdac/dacdrv.o chipset/chipdrv.o clock/clockdrv.o\
          monitor/mondrv.o
	@$(LD) -retain-symbols-file .scrdrv_symbols -o $@ -r $^

ramdac/dacdrv.o: .config
	@$(MAKE) -C ramdac dacdrv.o

chipset/chipdrv.o: .config
	@$(MAKE) -C chipset chipdrv.o

clock/clockdrv.o: .config
	@$(MAKE) -C clock clockdrv.o

kernel/driver.o: .config
	@$(MAKE) -C kernel driver.o

monitor/mondrv.o: .config
	@$(MAKE) -C monitor mondrv.o

include .recursive
