1# -*- Mode: Makefile -*-
2#
3# $Id: Makefile,v 0.1 2001/03/31 10:04:36 ram Exp $
4#
5#  Copyright (c) 2000-2001, Christophe Dehaudt & Raphael Manfredi
6#
7#  You may redistribute only under the terms of the Artistic License,
8#  as specified in the README file that comes with the distribution.
9#
10# HISTORY
11# $Log: Makefile,v $
12# Revision 0.1  2001/03/31 10:04:36  ram
13# Baseline for first Alpha release.
14#
15# $EndLog$
16#
17
18BYACC = pbyacc
19BYACC_P = Parser
20BYACC_OPT = -P $(BYACC_P)
21BYACC_FILE = ./Parser.y
22BYACC_TARGET = ./$(BYACC_P).pm
23
24RM = /bin/rm
25
26$(BYACC_TARGET): $(BYACC_FILE)
27	@if test -e $(BYACC_TARGET) -a ! -w $(BYACC_TARGET); then \
28		@echo "$(BYACC_TARGET) is not writable"; \
29	else echo "$(BYACC) $(BYACC_OPT) $(BYACC_FILE)"; \
30		$(BYACC) $(BYACC_OPT) $(BYACC_FILE) && \
31		perl -pi \
32			-e 's/[^\\](\$$\$$1)/\\$$1/g;' \
33			-e 's/\$$\$$1/\$$\\\$$1/g' $(BYACC_TARGET); \
34	fi;
35
36clean::
37	$(RM) -f $(BYACC_TARGET)
38
39