# $Id$
#
# Copyright 1989-2016 MINES ParisTech
#
# This file is part of PIPS.
#
# PIPS 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 3 of the License, or
# any later version.
#
# PIPS 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 PIPS.  If not, see <http://www.gnu.org/licenses/>.
#

TARGET	= pipsmake
YOPT	= -d
INC_CFILES =	pipsmake.c \
		activate.c \
		openclose.c \
		callback.c \
		unsplit.c \
		stubs.c \
		view.c \
		signal.c
INC_YFILES=readmakefile.y lexer.l

DERIVED_HEADERS = readmakefile.h
DERIVED_CFILES = readmakefile.c lexer.c

LIB_CFILES =	$(DERIVED_CFILES)  $(INC_CFILES)
INC_TARGET = $(TARGET).h
LIB_TARGET = lib$(TARGET).a

# common stuff
ROOT    = ../../..
PROJECT = pips
include $(ROOT)/makes/main.mk

# local specials
clean: local-clean

local-clean:
	$(RM) $(DERIVED_CFILES) $(DERIVED_HEADERS)

$(TARGET).h: $(DERIVED_CFILES)

# pipsmake parser
lexer.c: lexer.l
	$(SCAN) --prefix='pipsmake_' $< | $(SCANFIX) > $@

readmakefile.c: readmakefile.y
	$(PARSE) --name-prefix='pipsmake_' readmakefile.y
	mv y.tab.c readmakefile.c
	mv y.tab.h readmakefile.h
	$(RM) y.output

readmakefile.h: readmakefile.c
