#
# Makefile - makefile for mknbi program for MGL compiler
#
# Copyright (C) 1997-2003 Gero Kuhlmann <gero@gkminix.han.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 of the License, or
# 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.
#
# $Id: Makefile.in,v 1.5 2003/03/04 20:27:08 gkminix Exp $
#
# Directory names
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
# MANEXT is the manual section number
MANEXT = 8
############# Do not touch anything below this line #####################
CC = @CC@
BCC = @BCC@
CPP = @CPP@
YACC = @YACC@
LEX = @LEX@
AS86 = @AS86@
LD86 = @LD86@
INSTALL = @INSTALL@
@SET_MAKE@
# define location of other directories and files within this package
INCDIR = ../include
MISCDIR = ../misc
LIBDIR = ../nblib
MAKEC = $(MISCDIR)/makec
CDEBUG = @CFLAGS@ # -g
INCLUDE = -I. -I.. -I$(INCDIR)
CFLAGS = $(CDEBUG) @DEFS@ $(INCLUDE) -DPARANOID
YFLAGS = -d
LFLAGS =
LDFLAGS = -s
LIBS = -L$(LIBDIR) -lnb @LIBS@
YROOT = y.tab
LROOT = @LEX_OUTPUT_ROOT@
# define if certain parts of the development system are missing
DEV86 = @DEV86@
YSRCS = mglparse.y
LSRCS = mgllex.l
CSRCS = mknbi.c gencode.c genexpr.c expr.c runtime_c.c
OBJS = $(CSRCS:.c=.o) $(YROOT).o $(LROOT).o
TARGET = mknbi-mgl
.PHONY: all distrib install dep test interrors
all: $(TARGET)
$(TARGET): mknbi
mknbi: stamp-version runtime_c.c $(OBJS)
(cd $(LIBDIR) && $(MAKE) all) || exit 1
$(CC) -o mknbi $(LDFLAGS) $(OBJS) $(LIBS)
# generate C source for the parser
$(YROOT).o: $(YROOT).c $(YROOT).h
$(YROOT).c $(YROOT).h: $(YSRCS)
$(YACC) $(YFLAGS) $(YSRCS)
$(YSRCS:.y=.c): $(YROOT).c
@cp $(YROOT).c $(YSRCS:.y=.c)
$(YSRCS:.y=.h): $(YROOT).h
@cp $(YROOT).h $(YSRCS:.y=.h)
# generate C source for the lexer
$(LROOT).o: $(LROOT).c
$(LROOT).c: $(LSRCS)
$(LEX) $(LFLAGS) $(LSRCS)
$(LSRCS:.l=.c): $(LROOT).c
@cp $(LROOT).c $(LSRCS:.l=.c)
# generate C source file from runtime binary source
runtime_c.c: stamp-runtime-$(DEV86)
stamp-runtime-i86: runtime.S runtime.inc stamp-version stamp-makec
$(CPP) $(INCLUDE) runtime.S -o runtime.s
$(AS86) -0 -b runtime.b runtime.s
$(MAKEC) runtime <runtime.b >runtime_c.c
@rm -f runtime.s runtime.b
@touch stamp-runtime-i86
stamp-runtime-no86:
@touch runtime_c.c
@touch stamp-runtime-no86
# generate various required files which can be found in other directories
stamp-version:
(cd $(INCDIR) && $(MAKE) version.h) || exit 1
@touch stamp-version
stamp-makec:
(cd $(MISCDIR) && $(MAKE) makec) || exit 1
@touch stamp-makec
# Distrib generates all files which are not removed by distclean
distrib: $(YSRCS:.y=.c) $(YSRCS:.y=.h) $(LSRCS:.l=.c) stamp-runtime-i86
test:
@(cd test; \
$(MAKE) all || exit 1)
interrors:
cat $(CSRCS) $(YSRCS) $(LSRCS) | grep "interror(" | \
tr -d "\t" | sort >interrors
install: all
$(INSTALL) -d $(bindir)
$(INSTALL) -d $(mandir)/man$(MANEXT)
$(INSTALL) -m 511 mknbi $(bindir)/$(TARGET)
$(INSTALL) -m 644 -o bin -g bin mknbi.man $(mandir)/man$(MANEXT)/$(TARGET).$(MANEXT)
dep: stamp-version
sed '/\#\#\# Dependencies/q' <Makefile >tmp_make
$(CPP) $(CFLAGS) -MM $(CSRCS) >>tmp_make
mv tmp_make Makefile
.PHONY: clean distclean realclean
clean:
rm -f *.o *.s *.b *.map mknbi tmp_make core
rm -f $(YROOT).c $(YROOT).h $(LROOT).c
rm -f y.output interrors
rm -f stamp-*
@(cd test; \
$(MAKE) clean || exit 1)
distclean: clean
rm -f Makefile
realclean: distclean
rm -f runtime_c.c
rm -f $(YSRCS:.y=.c) $(YSRCS:.y=.h) $(LSRCS:.l=.c)
### Dependencies
syntax highlighted by Code2HTML, v. 0.9.1