/*
 *                            COPYRIGHT
 *
 *  PCB, interactive printed circuit board design
 *  Copyright (C) 1994,1995,1996 Thomas Nau
 *
 *  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 of the License, 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; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  Contact addresses for paper mail and Email:
 *  Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
 *  Thomas.Nau@rz.uni-ulm.de
 *
 *  RCS: $Id: Imakefile,v 145.1 1997/07/26 12:56:35 nau Exp $
 */

#include "../config.h"

/* ------------------- don't change anything here --------------------------
 * apply changes to ../config.h
 */

TARGETS = $(DEFAULTLIBRARY) $(DEFAULTLIBRARY).contents
COMMON  = common.m4
INC     = connector.inc dil.inc misc.inc plcc.inc to.inc qfp.inc

SRC     = TTL_74xx_DIL.m4 \
		  crystal.m4 connector.m4 generic.m4 \
		  linear.m4 logic.m4 lsi.m4 memory.m4 \
		  optical.m4 resistor_array.m4 resistor_0.25W.m4 \
		  texas_inst_voltage_reg.m4 texas_inst_amplifier.m4 \
		  transistor.m4

LIST    = TTL_74xx_DIL.list \
		  crystal.list connector.list generic.list \
		  linear.list logic.list lsi.list memory.list \
		  optical.list resistor_array.list resistor_0.25W.list \
		  texas_inst_voltage_reg.list texas_inst_amplifier.list \
		  transistor.list

SCRIPTS = CreateLibrary.sh CreateLibraryContents.sh \
          ListLibraryContents.sh QueryLibrary.sh

all:: $(TARGETS)

InstallMultipleFlags($(TARGETS),$(PCBLIBDIR),$(INSTLIBFLAGS))
InstallMultipleFlags($(SCRIPTS),$(PCBLIBDIR),$(INSTBINFLAGS))
InstallMultipleFlags($(SRC),$(PCBLIBDIR)/m4,$(INSTLIBFLAGS))
InstallMultipleFlags($(LIST),$(PCBLIBDIR)/m4,$(INSTLIBFLAGS))
InstallMultipleFlags($(COMMON),$(PCBLIBDIR)/m4,$(INSTLIBFLAGS))
InstallMultipleFlags($(INC),$(PCBLIBDIR)/m4,$(INSTLIBFLAGS))

$(DEFAULTLIBRARY): $(COMMON) $(INC) $(SRC) $(SCRIPTS)
	@./CreateLibrary.sh $(DEFAULTLIBRARY) $(COMMON) $(SRC)

$(DEFAULTLIBRARY).contents: $(COMMON) $(INC) $(LIST) $(SCRIPTS)
	@./CreateLibraryContents.sh $(COMMON) $(LIST) > $(DEFAULTLIBRARY).contents

sed.script: ../config.h
	@cd ../src; $(MAKE) $(MFLAGS) sed.script
	ln -s ../src/sed.script .

CreateLibrary.sh: CreateLibrary.sh.raw sed.script
	@sed -f sed.script  < CreateLibrary.sh.raw > $@
	chmod +x $@

CreateLibraryContents.sh: CreateLibraryContents.sh.raw sed.script
	@sed -f sed.script  < CreateLibraryContents.sh.raw > $@
	chmod +x $@

QueryLibrary.sh: QueryLibrary.sh.raw sed.script
	@sed -f sed.script  < QueryLibrary.sh.raw > $@
	chmod +x $@

clean::
	$(RM) sed.script
	$(RM) $(TARGETS) QueryLibrary.sh CreateLibrary.sh CreateLibraryContents.sh

install.info::

dist::

includes::

depend::
