[capidl] cvs commit: capidl makerules.mk makevars.mk Makefile SymTab.cxx gram.y lex.l

shap@eros.cs.jhu.edu shap@eros.cs.jhu.edu
Mon, 17 Sep 2001 15:12:03 -0400


shap        01/09/17 15:12:03

  Modified:    .        Makefile SymTab.cxx gram.y lex.l
  Added:       .        makerules.mk makevars.mk
  Log:
  Cleaned up checkin for in-progress UNIX capidl implementation

Revision  Changes    Path
1.2       +7 -8      capidl/Makefile

Index: Makefile
===================================================================
RCS file: /cvs/capidl/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile	2001/09/17 18:43:23	1.1
+++ Makefile	2001/09/17 19:12:02	1.2
@@ -19,11 +19,9 @@
 #
 
 
-# Utility to convert a linux a.out file to a domain image file.
-default: package
+default: all
 
-EROS_SRC=../../../..
-include $(EROS_SRC)/build/lib/make/makevars.mk
+include makevars.mk
 
 
 TARGETS=capidl
@@ -32,13 +30,14 @@
 #OPTIM=-O
 OPTIM=-g
 OBJECTS= gram.o lex.o SymTab.o
-INC=	-I$(EROS_ROOT)/cross/include $(XENV_INCLUDE)
-LIBS=	$(EROS_ROOT)/cross/lib/liberos.a $(EROS_ROOT)/cross/lib/libdisk.a
-LIBS+=	$(EROS_ROOT)/cross/lib/libzlib.a
+OBJECTS += Intern.o App.o AppPath.o AppExit.o AppFile.o Diag.o
+INC=	-I.
+LIBS=
 OTHER_LIBS=	-lbfd -liberty -lgmp
 DIRS=
+VPATH=.:applib
 
-include $(EROS_SRC)/build/lib/make/makerules.mk
+include makerules.mk
 
 all: $(TARGETS)
 



1.2       +2 -3      capidl/SymTab.cxx

Index: SymTab.cxx
===================================================================
RCS file: /cvs/capidl/SymTab.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SymTab.cxx	2001/09/17 18:43:23	1.1
+++ SymTab.cxx	2001/09/17 19:12:02	1.2
@@ -23,9 +23,8 @@
 /* GNU multiple precision library: */
 #include <gmp.h>
 
-#include <eros/target.h>
-#include <erosimg/Intern.hxx>
-#include <erosimg/Diag.hxx>
+#include <applib/Intern.hxx>
+#include <applib/Diag.hxx>
 #include "SymTab.hxx"
 
 Symbol *GlobalScope = 0;	/* scope for global symbols */



1.2       +3 -6      capidl/gram.y

Index: gram.y
===================================================================
RCS file: /cvs/capidl/gram.y,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gram.y	2001/09/17 18:43:23	1.1
+++ gram.y	2001/09/17 19:12:02	1.2
@@ -79,12 +79,9 @@
 /* GNU multiple precision library: */
 #include <gmp.h>
 
-#include <eros/target.h>
-#include <erosimg/Intern.hxx>
-#include <erosimg/App.hxx>
-#include <erosimg/ErosImage.hxx>
-#include <erosimg/StrBuf.hxx>
-
+#include <applib/App.hxx>
+#include <applib/Intern.hxx>
+#include <applib/StrBuf.hxx>
 #include "SymTab.hxx"
 #include "ParseType.hxx"
 



1.2       +2 -6      capidl/lex.l

Index: lex.l
===================================================================
RCS file: /cvs/capidl/lex.l,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lex.l	2001/09/17 18:43:23	1.1
+++ lex.l	2001/09/17 19:12:02	1.2
@@ -27,12 +27,8 @@
 /* GNU multiple precision library: */
 #include <gmp.h>
 
-#include <eros/target.h>
-#include <erosimg/Intern.hxx>
-
-#include <eros/target.h>
-#include <erosimg/App.hxx>
-#include <erosimg/ErosImage.hxx>
+#include <applib/Intern.hxx>
+#include <applib/App.hxx>
 
 #include "SymTab.hxx"
 #include "ParseType.hxx"



1.1                  capidl/makerules.mk

Index: makerules.mk
===================================================================
#
# Copyright (C) 2001, Jonathan S. Shapiro.
#
# This file is part of the EROS Operating System.
#
# 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; if not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#


unexport DIRS
unexport ETAGDIRS
unexport GENERATED
unexport CLEANLIST

# The following variables depend on things set in the makefile:
GCCFLAGS=$(CFLAGS) $(OPTIM) $(INC) $(DEF)
GPLUSFLAGS=-fdefault-inline -fno-implicit-templates $(OPTIM) $(GPLUS_OPTIM) $(INC) $(DEF)

ifndef CLEANDIRS
CLEANDIRS=$(DIRS)
endif


SEDHACK=sed 's,'$*'\.o[ :]*,'$@' &,g'
DEP_SEDHACK=sed 's,^[^:]*:[:]*,'$@' &,g'
#DEP_SEDHACK=sed 's,'$*'\.o[ :]*,'$@' &,g'

C_DEP=@$(GCC) $(GCCFLAGS) $(GCCWARN) -E -M $< | $(DEP_SEDHACK) > $@
CXX_DEP=@$(GPLUS) $(GPLUSFLAGS) $(GPLUSWARN) -E -M $< | $(DEP_SEDHACK) > $@
ASM_DEP=@$(GPLUS) $(GCCFLAGS) -E -M $< | $(DEP_SEDHACK) > $@

C_BUILD=$(GCC) $(GCCFLAGS) $(GCCWARN) -c $<
CXX_BUILD=$(GPLUS) $(GPLUSFLAGS) $(GPLUSWARN) -c $<
ASM_BUILD=$(GPLUS) $(GCCFLAGS) -c $< -o $@
#
# OLD autodependency rules -- retained for the time being.
#

# use GPLUS to allow C++ style comments:
#.S.m:
#	@$(GPLUS) $(GCCFLAGS) -E -M $< | $(SEDHACK) > $@
#
#.s.m:
#	@echo "Please rewrite .s file as .S file"
#
#.c.m:
#	@$(GCC) $(GCCFLAGS) $(GCCWARN) -E -M $< | $(SEDHACK) > $@
#
#
#.cxx.m:
#	@$(GPLUS) $(GPLUSFLAGS) $(GPLUSWARN) -E -M $< | $(SEDHACK) > $@


.%.m: %.S
	@$(GPLUS) $(GCCFLAGS) -E -M $< | $(SEDHACK) > $@

.%.m: %.s
	@echo "Please rewrite .s file as .S file"

.%.m: %.c
	@$(GCC) $(GCCFLAGS) -E -M $< | $(SEDHACK) > $@


.%.m: %.cxx
	@$(GPLUS) $(GPLUSFLAGS) $(GPLUSWARN) -E -M $< | $(SEDHACK) > $@

#
# Object construction rules
#

.S.o:
	$(GPLUS) $(GCCFLAGS) -c $< -o $@

.c.o:
	$(GCC) $(GCCFLAGS) $(GCCWARN) -c $<

.cxx.o:
	$(GPLUS) $(GPLUSFLAGS) $(GPLUSWARN) -c $<

# Rules to process XML files to produce HTML:
.xml.html:
	$(XSLT) -o $@ $(EROS_SRC)/doc/www/DTD/html-doc.xslt $<

.%.xml.m: %.xml
	@echo "$(<:.xml=.html): $< $(EROS_SRC)/doc/www/DTD/html-doc.xslt" > $@

.ltx.dvi:
	latex $<
	latex $<

.fig.gif:
	@if [ \! -x $(NETPBMDIR)/ppmtogif ]; then\
		echo "ERROR: Please set the NETPBMDIR environment variable to identify"; \
		echo "       the location of the NetPBM directory."; \
		exit 1;\
	fi
	fig2dev -L ppm $< $*.ppm
	$(NETPBMDIR)/ppmtogif -t '#ffffff' $*.ppm > $@
	-rm -f $*.ppm

.PHONEY : depend nodepend recursive-depend all recursive-all install recursive-install clobber walk clean do-clean recursive-clean world

world:
	$(MAKE) -C $(EROS_SRC) $(MAKERULES) install

depend: recursive-depend DEPEND
recursive-depend:
ifneq "$(DIRS)" ""
	@for i in $(DIRS); do \
		if [ -d "$$i" ]; then\
			$(MAKE) -C $$i $(MAKERULES) depend; \
			if [ $$? -ne 0 ]; then\
				echo "*** RECURSIVE BUILD STOPS ***";\
				exit 1;\
			fi; \
		fi; \
	done
endif

all: recursive-all
recursive-all:
ifneq "$(DIRS)" ""
	@for i in $(DIRS); do \
		if [ -d "$$i" ]; then\
			$(MAKE) -C $$i $(MAKERULES) all; \
			if [ $$? -ne 0 ]; then\
				echo "*** RECURSIVE BUILD STOPS ***";\
				exit 1;\
			fi; \
		fi; \
	done
endif

install: recursive-install
recursive-install:
ifneq "$(DIRS)" ""
	@for i in $(DIRS); do \
		if [ -d "$$i" ]; then\
			$(MAKE) -C $$i $(MAKERULES) install; \
			if [ $$? -ne 0 ]; then\
				echo "*** RECURSIVE BUILD STOPS ***";\
				exit 1;\
			fi; \
		fi; \
	done
endif

# The following hack fixes up directory dependencies, and ALSO ensures
# that the .m files will be rebuilt when appropriate:
DEPEND: $(patsubst %.o,.%.m,$(OBJECTS)) $(patsubst %.xml,.%.xml.m,$(wildcard *.xml))
#	@if [ -n "$(OBJECTS:.o=.m)" ]; then\
#		cat *.m | sed "s, $(EROS_ROOT), \$$(EROS_ROOT),g" > DEPEND; \
#	fi
#	@touch DEPEND    # in case no .m files
#	@-rm -f *.m



#local-depend: 
#	@sed -e '/^### Output of make depend:/,$$d' Makefile > new.Makefile
#	@echo "### Output of make depend:" >> new.Makefile
#	@if [ -n "$(OBJECTS:.o=.m)" ]; then\
#		cat *.m | sed "s, $(EROS_ROOT), \$$(EROS_ROOT),g" >> new.Makefile; \
#	fi
#	@-rm -f *.m
#	@mv Makefile old.Makefile
#	@mv new.Makefile Makefile
#	@-rm -f old.Makefile

all install: DEPEND

nodepend:
	-find . -name '*.m' -exec rm {} \;
	-find . -name '.*.m' -exec rm {} \;
	-find . -name 'DEPEND' -exec rm {} \;

## The following piece of idiocy works around the fact that the
## autodependency files may refer to stuff that has been cleaned,
## and that this can therefore perversely cause the clean target to
## fail.
clean: nodepend
	$(MAKE) $(MAKERULES) do-clean

do-clean: recursive-clean
	-rm -f *.o *.m core *~ new.Makefile  ".#"*
	-rm -f .*.m sysgen.map $(TARGETS) TAGS
	-rm -f *.dvi *.blg *.aux *.log *.toc $(CLEANLIST)

recursive-clean:
ifneq "$(CLEANDIRS)" ""
	@for i in $(CLEANDIRS); do \
		if [ -d "$$i" ]; then\
			$(MAKE) -C $$i $(MAKERULES) do-clean; \
			if [ $$? -ne 0 ]; then\
				echo "*** RECURSIVE BUILD STOPS ***";\
				exit 1;\
			fi; \
		fi; \
	done
endif

## The following piece of idiocy works around the fact that the
## autodependency files may refer to stuff that has been clobbered,
## and that this can therefore perversely cause the clobber target to
## fail.
clobber:
	@echo "Clobber target now obsolete: use clean instead"
	$(MAKE) $(MAKERULES) clean

ifdef ETAGDIRS
ETAGEXPAND=$(patsubst %,%/*.c,$(ETAGDIRS))
ETAGEXPAND+=$(patsubst %,%/*.cxx,$(ETAGDIRS))
ETAGEXPAND+=$(patsubst %,%/*.hxx,$(ETAGDIRS))
ETAGEXPAND+=$(patsubst %,%/*.h,$(ETAGDIRS))

ASM_ETAGEXPAND+=$(patsubst %,%/*.S,$(ETAGDIRS))

ETAGFILES=$(wildcard $(ETAGEXPAND))
ASM_ETAGFILES=$(wildcard $(ASM_ETAGEXPAND))
unexport ETAGEXPAND
unexport ETAGFILES
unexport ASM_ETAGEXPAND
unexport ASM_ETAGFILES

#	--regex='/^struct[ \t]+\([A-Za-z0-9_]+\)[ \t]*:[ \t]*public[ \t]+\([A-Za-z0-9_]+\)/:public \1 \2/' \
#	--regex='/^class[ \t]+\([A-Za-z0-9_]+\)[ \t]*:[ \t]*public[ \t]+\([A-Za-z0-9_]+\)/:public \1 \2/' \

tags: local-tags recursive-tags
local-tags:
	etags \
	--regex='/^struct[ \t]+\([A-Za-z0-9_]+\)[ \t]*:[ \t]*public[ \t]+\([A-Za-z0-9_]+\)/:public \1 \2/' \
	--regex='/^class[ \t]+\([A-Za-z0-9_]+\)[ \t]*:[ \t]*public[ \t]+\([A-Za-z0-9_]+\)/:public \1 \2/' \
	   $(ETAGFILES)
ifneq ($(ASM_ETAGFILES),)
	etags --append --lang=none \
		--regex='/^\(ENTRY\|GEXT\)([A-Za-z0-9_\.]+)/' \
		$(ASM_ETAGFILES)
endif
else
tags: recursive-tags
endif
recursive-tags:
ifneq "$(DIRS)" ""
	@for i in $(DIRS); do \
		if [ -d "$$i" ]; then\
			$(MAKE) -C $$i $(MAKERULES) tags; \
			if [ $$? -ne 0 ]; then\
				echo "*** RECURSIVE BUILD STOPS ***";\
				exit 1;\
			fi; \
		fi; \
	done
endif

generated: $(GENERATED) recursive-generated
recursive-generated:
ifneq "$(DIRS)" ""
	@for i in $(DIRS); do \
		if [ -d "$$i" ]; then\
			$(MAKE) -C $$i $(MAKERULES) generated; \
			if [ $$? -ne 0 ]; then\
				echo "*** RECURSIVE BUILD STOPS ***";\
				exit 1;\
			fi; \
		fi; \
	done
endif

# This is a debugging target..
walk:
ifneq "$(DIRS)" ""
	@for i in $(DIRS); do \
		$(MAKE) -C $$i $(MAKERULES) walk; \
		if [ $$? -ne 0 ]; then\
			echo "*** RECURSIVE BUILD STOPS ***";\
			exit 1;\
		fi; \
	done
endif



1.1                  capidl/makevars.mk

Index: makevars.mk
===================================================================
#
# Copyright (C) 2001, Jonathan S. Shapiro.
#
# This file is part of the EROS Operating System.
#
# 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; if not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

# Cancel the old suffix list, because the order matters.  We want assembly 
# source to be recognized in preference to ordinary source code, so the
# .S, .s cases must come ahead of the rest.
.SUFFIXES:
.SUFFIXES: .S .s .cxx .c .y .l .o .dvi .ltx .gif .fig .xml .html

# Some shells do not export this variable, and it is used in the package
# generation rule below.
ifeq "$(PWD)" ""
PWD=$(shell pwd)
endif

#
# First, set up variables for building native tools:
#
GAWK=gawk
PYTHON=python
#XML_LINT=$(EROS_XENV)/bin/xmllint
#XSLT=$(EROS_XENV)/bin/xsltproc

STRIP=strip
OBJDUMP=objdump
SIZE=size
AR=ar
LD=ld
RANLIB=ranlib

GCC=gcc
GCCWARN=-Wall -Winline -Werror -Wno-format

GPLUS=g++
GPLUSWARN=-Wall -Winline -Werror -Wno-format

# search for ppmtogif in all the obvious places:
ifndef NETPBMDIR
ifneq "" "$(findstring /usr/bin/ppmtogif,$(wildcard /usr/bin/*))"
NETPBMDIR=/usr/bin
endif
endif

ifndef NETPBMDIR
ifneq "" "$(findstring /usr/bin/X11/ppmtogif,$(wildcard /usr/bin/X11/*))"
NETPBMDIR=/usr/bin/X11
endif
endif

ifndef NETPBMDIR
ifneq "" "$(findstring /usr/local/netpbm/ppmtogif,$(wildcard /usr/local/netpbm/*))"
NETPBMDIR=/usr/local/netpbm
endif
endif