First milestone of replacing the build system.
--HG-- branch : dtrg-buildsystem rename : lang/cem/cpp.ansi/Parameters => lang/cem/cpp.ansi/parameters.h
This commit is contained in:
55
util/LLgen/build.mk
Normal file
55
util/LLgen/build.mk
Normal file
@@ -0,0 +1,55 @@
|
||||
D := util/LLgen
|
||||
|
||||
# Rule to build LLgen.
|
||||
|
||||
define build-llgen-impl
|
||||
$(call reset)
|
||||
$(eval cflags += -DNON_CORRECTING -DLIBDIR=\"$(abspath $D/lib)\")
|
||||
$(call cfile, $D/src/main.c)
|
||||
$(call cfile, $D/src/gencode.c)
|
||||
$(call cfile, $D/src/compute.c)
|
||||
$(call cfile, $D/src/check.c)
|
||||
$(call cfile, $D/src/reach.c)
|
||||
$(call cfile, $D/src/global.c)
|
||||
$(call cfile, $D/src/name.c)
|
||||
$(call cfile, $D/src/sets.c)
|
||||
$(call cfile, $D/src/alloc.c)
|
||||
$(call cfile, $D/src/machdep.c)
|
||||
$(call cfile, $D/src/cclass.c)
|
||||
$(call cfile, $D/src/savegram.c)
|
||||
|
||||
# These use pre-LLgen'd version of the files. If LLgen.g gets updated,
|
||||
# they need rebuilding. Use the bootstrap script to do this.
|
||||
|
||||
$(call cfile, $D/src/LLgen.c)
|
||||
$(call cfile, $D/src/Lpars.c)
|
||||
$(call cfile, $D/src/tokens.c)
|
||||
|
||||
$(call cprogram, $(BINDIR)/LLgen)
|
||||
LLGEN := $o
|
||||
endef
|
||||
|
||||
$(eval $(build-llgen-impl))
|
||||
|
||||
# Rule to invoke to *use* LLgen.
|
||||
#
|
||||
# $1: directory to put output files
|
||||
# $2: input files
|
||||
#
|
||||
# Output files are compiled via cfile and queued.
|
||||
|
||||
define llgen-impl
|
||||
$(eval o := $1/Lpars.c $(patsubst %.g, $(strip $1)/%.c, $(notdir $2)))
|
||||
$(eval CLEANABLES += $o $1/Lpars.h)
|
||||
|
||||
$o: $1/Lpars.h
|
||||
$1/Lpars.h: $2 $(LLGEN)
|
||||
@echo LLGEN $1/Lpars.c
|
||||
@mkdir -p $(dir $o)
|
||||
$(hide) cd $(dir $o) && $(LLGEN) $(abspath $2)
|
||||
|
||||
$(foreach f,$o,$(call cfile,$f))
|
||||
|
||||
endef
|
||||
|
||||
llgen = $(eval $(call llgen-impl,$1,$2))
|
||||
@@ -17,6 +17,7 @@
|
||||
* Also checks the continuation grammar from the specified grammar.
|
||||
*/
|
||||
|
||||
# include <stdlib.h>
|
||||
# include "types.h"
|
||||
# include "extern.h"
|
||||
# include "sets.h"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* This file is a mess, it should be cleaned up some time.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
# include "types.h"
|
||||
# include "io.h"
|
||||
# include "extern.h"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
# include "types.h"
|
||||
# include "extern.h"
|
||||
# include "io.h"
|
||||
|
||||
57
util/ack/build.mk
Normal file
57
util/ack/build.mk
Normal file
@@ -0,0 +1,57 @@
|
||||
D := util/ack
|
||||
|
||||
define util-ack-makeheaders-rule
|
||||
$(eval g := $(OBJDIR)/$D/dmach.c $(OBJDIR)/$D/intable.c)
|
||||
$(wordlist 2, $(words $g), $g): $(firstword $g)
|
||||
$(firstword $g): $(util-ack-mktables)
|
||||
@echo MKTABLES
|
||||
@mkdir -p $(dir $g)
|
||||
$(hide) cd $(dir $g) && $(util-ack-mktables) $(INSDIR)/share
|
||||
|
||||
$(eval CLEANABLES += $g)
|
||||
endef
|
||||
|
||||
define build-ack-impl
|
||||
$(call reset)
|
||||
$(call cfile, $D/mktables.c)
|
||||
$(call cprogram, $(OBJDIR)/$D/mktables)
|
||||
$(eval util-ack-mktables := $o)
|
||||
|
||||
$(call reset)
|
||||
$(eval cflags += -I$D)
|
||||
$(call cfile, $D/list.c)
|
||||
$(call cfile, $D/data.c)
|
||||
$(call cfile, $D/main.c)
|
||||
$(call cfile, $D/scan.c)
|
||||
$(call cfile, $D/svars.c)
|
||||
$(call cfile, $D/trans.c)
|
||||
$(call cfile, $D/util.c)
|
||||
|
||||
$(call cfile, $D/rmach.c)
|
||||
$(call dependson, $(INCDIR)/em_path.h)
|
||||
|
||||
$(call cfile, $D/run.c)
|
||||
$(call cfile, $D/grows.c)
|
||||
|
||||
$(call cfile, $D/files.c)
|
||||
$(call dependson, $(INCDIR)/em_path.h)
|
||||
|
||||
$(eval $(util-ack-makeheaders-rule))
|
||||
$(call cfile, $(OBJDIR)/$D/dmach.c)
|
||||
$(call cfile, $(OBJDIR)/$D/intable.c)
|
||||
|
||||
$(call cprogram, $(BINDIR)/ack)
|
||||
$(call installto, $(INSDIR)/bin/ack)
|
||||
$(eval ACK := $o)
|
||||
|
||||
$(call reset)
|
||||
$(eval q := lib/descr/fe)
|
||||
$(call installto, $(PLATIND)/descr/fe)
|
||||
$(eval $(ACK): $o)
|
||||
|
||||
$(call reset)
|
||||
$(eval q := $D/ack.1.X)
|
||||
$(call installto, $(INSDIR)/share/man/man1/ack.1)
|
||||
endef
|
||||
|
||||
$(eval $(build-ack-impl))
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "ack.h"
|
||||
#include "list.h"
|
||||
#include "trans.h"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "ack.h"
|
||||
#include "grows.h"
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "ack.h"
|
||||
#include "list.h"
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "ack.h"
|
||||
#include <em_path.h>
|
||||
#include "list.h"
|
||||
@@ -11,7 +13,6 @@
|
||||
#include "grows.h"
|
||||
#include "dmach.h"
|
||||
#include "data.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Id$" ;
|
||||
|
||||
22
util/amisc/build.mk
Normal file
22
util/amisc/build.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
define build-simple-tool-impl
|
||||
$(call reset)
|
||||
$(call cfile, util/amisc/$1.c)
|
||||
$(call file, $(LIBOBJECT))
|
||||
$(call cprogram, $(BINDIR)/$1)
|
||||
$(eval INSTALLABLES += $o)
|
||||
$(call installto, $(INSDIR)/bin/$1)
|
||||
|
||||
$(call reset)
|
||||
$(eval q := util/amisc/$1.1)
|
||||
$(call installto, $(INSDIR)/share/man/man1/$1.1)
|
||||
endef
|
||||
|
||||
build-simple-tool = $(eval $(build-simple-tool-impl))
|
||||
|
||||
$(call build-simple-tool,anm)
|
||||
$(call build-simple-tool,ashow)
|
||||
$(call build-simple-tool,asize)
|
||||
$(call build-simple-tool,aslod)
|
||||
$(call build-simple-tool,astrip)
|
||||
|
||||
23
util/arch/build.mk
Normal file
23
util/arch/build.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
D := util/arch
|
||||
|
||||
define build-aal-impl
|
||||
$(call reset)
|
||||
$(eval cflags += -DAAL)
|
||||
|
||||
$(call cfile, $D/archiver.c)
|
||||
|
||||
$(call file, $(LIBOBJECT))
|
||||
$(call file, $(LIBPRINT))
|
||||
$(call file, $(LIBSTRING))
|
||||
$(call file, $(LIBSYSTEM))
|
||||
|
||||
$(call cprogram, $(BINDIR)/aal)
|
||||
$(call installto, $(INSDIR)/bin/aal)
|
||||
$(eval AAL := $o)
|
||||
|
||||
$(call reset)
|
||||
$(eval q := $D/aal.1)
|
||||
$(call installto, $(INSDIR)/share/man/man1/aal.1)
|
||||
endef
|
||||
|
||||
$(eval $(build-aal-impl))
|
||||
31
util/cmisc/build.mk
Normal file
31
util/cmisc/build.mk
Normal file
@@ -0,0 +1,31 @@
|
||||
# Building tabgen.
|
||||
|
||||
define build-tabgen-impl
|
||||
$(call reset)
|
||||
$(call cfile, util/cmisc/tabgen.c)
|
||||
$(call cprogram, $(BINDIR)/tabgen)
|
||||
$(eval TABGEN := $o)
|
||||
endef
|
||||
|
||||
$(eval $(build-tabgen-impl))
|
||||
|
||||
# Using tabgen.
|
||||
#
|
||||
# $1 = input file
|
||||
#
|
||||
# Output file is compiled with cfile and queued.
|
||||
|
||||
define tabgen-impl
|
||||
$(eval g := $(OBJDIR)/$(strip $1).c)
|
||||
|
||||
$g: $1 $(TABGEN)
|
||||
@echo TABGEN $g
|
||||
@mkdir -p $(dir $g)
|
||||
$(hide) $(TABGEN) -f$(strip $1) > $g || $(RM) $g
|
||||
|
||||
$(eval CLEANABLES += $g)
|
||||
$(call cfile,$g)
|
||||
endef
|
||||
|
||||
tabgen = $(eval $(call tabgen-impl,$1))
|
||||
|
||||
@@ -61,7 +61,7 @@ replace(idef)
|
||||
return 0;
|
||||
}
|
||||
if (++mac->mc_count > 100) {
|
||||
/* 100 must be some number in Parameters */
|
||||
/* 100 must be some number in parameters.h */
|
||||
warning("macro %s is assumed recursive",
|
||||
idef->id_text);
|
||||
return 0;
|
||||
|
||||
29
util/data/build.mk
Normal file
29
util/data/build.mk
Normal file
@@ -0,0 +1,29 @@
|
||||
D := util/data
|
||||
|
||||
define util-data-impl
|
||||
|
||||
$(eval g := \
|
||||
$(INCDIR)/em_spec.h \
|
||||
$(INCDIR)/em_pseu.h \
|
||||
$(INCDIR)/em_mnem.h \
|
||||
$(OBJDIR)/$D/em_flag.c \
|
||||
$(OBJDIR)/$D/em_pseu.c \
|
||||
$(OBJDIR)/$D/em_mnem.c)
|
||||
|
||||
$(eval CLEANABLES += $g)
|
||||
$g: $D/new_table h/em_table
|
||||
@echo DATA
|
||||
@mkdir -p $(dir $g)
|
||||
$(hide) $D/new_table h/em_table $(INCDIR) $(OBJDIR)/$D
|
||||
|
||||
$(call reset)
|
||||
$(call cfile, $(OBJDIR)/$D/em_flag.c)
|
||||
$(call cfile, $(OBJDIR)/$D/em_pseu.c)
|
||||
$(call cfile, $(OBJDIR)/$D/em_mnem.c)
|
||||
$(call cfile, $D/em_ptyp.c)
|
||||
$(call clibrary, $(LIBDIR)/libem_data.a)
|
||||
$(eval LIBEM_DATA := $q)
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(util-data-impl))
|
||||
@@ -57,7 +57,7 @@ struct code_info {
|
||||
#define LP_HEADER lp_extend->lpx_sr.lpx_header
|
||||
#define LP_INSTR lp_extend->lpx_sr.lpx_instr
|
||||
|
||||
/* Parameters to be provided by environment: */
|
||||
/* parameters.h to be provided by environment: */
|
||||
|
||||
extern int ovfl_harmful; /* Does overflow during multiplication
|
||||
* cause a trap ?
|
||||
|
||||
41
util/ncgg/build.mk
Normal file
41
util/ncgg/build.mk
Normal file
@@ -0,0 +1,41 @@
|
||||
D := util/ncgg
|
||||
|
||||
define build-ncgg-impl
|
||||
|
||||
$(call reset)
|
||||
$(eval cflags += -I$D)
|
||||
|
||||
$(call yacc, $(OBJDIR)/$D, $D/cgg.y)
|
||||
|
||||
$(call flex, $(OBJDIR)/$D, $D/scan.l)
|
||||
$(call dependson, $(OBJDIR)/$D/y.tab.h)
|
||||
|
||||
$(call cfile, $D/subr.c)
|
||||
$(call cfile, $D/main.c)
|
||||
$(call cfile, $D/coerc.c)
|
||||
$(call cfile, $D/error.c)
|
||||
$(call cfile, $D/emlookup.c)
|
||||
$(call cfile, $D/expr.c)
|
||||
$(call cfile, $D/instruct.c)
|
||||
$(call cfile, $D/iocc.c)
|
||||
$(call cfile, $D/lookup.c)
|
||||
$(call cfile, $D/output.c)
|
||||
$(call cfile, $D/set.c)
|
||||
$(call cfile, $D/strlookup.c)
|
||||
$(call cfile, $D/var.c)
|
||||
$(call cfile, $D/hall.c)
|
||||
|
||||
$(eval CLEANABLES += $(OBJDIR)/$D/enterkeyw.c)
|
||||
$(OBJDIR)/$D/enterkeyw.c: $D/cvtkeywords $D/keywords
|
||||
@echo KEYWORDS $$@
|
||||
@mkdir -p $$(dir $$@)
|
||||
$(hide) cd $$(dir $$@) && sh $(abspath $D/cvtkeywords) $(abspath $D/keywords)
|
||||
$(call cfile, $(OBJDIR)/$D/enterkeyw.c)
|
||||
|
||||
$(call file, $(LIBEM_DATA))
|
||||
$(call cprogram, $(BINDIR)/ncgg)
|
||||
$(eval NCGG := $o)
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(build-ncgg-impl))
|
||||
@@ -1100,4 +1100,3 @@ optregvartype
|
||||
{ $$ = $2; }
|
||||
;
|
||||
%%
|
||||
#include "scan.c"
|
||||
|
||||
@@ -7,6 +7,20 @@
|
||||
static char rcsid2[]= "$Id$";
|
||||
#endif
|
||||
|
||||
#include "param.h"
|
||||
#include "varinfo.h"
|
||||
#include "lookup.h"
|
||||
#include "set.h"
|
||||
#include "iocc.h"
|
||||
#include "instruct.h"
|
||||
#include "expr.h"
|
||||
#include "extern.h"
|
||||
#include <cgg_cg.h>
|
||||
#include <em_reg.h>
|
||||
#include "y.tab.h"
|
||||
|
||||
extern int emhere;
|
||||
|
||||
char *mystrcpy();
|
||||
int myatoi();
|
||||
|
||||
|
||||
78
util/opt/build.mk
Normal file
78
util/opt/build.mk
Normal file
@@ -0,0 +1,78 @@
|
||||
D := util/opt
|
||||
|
||||
define build-opt-mktab-impl
|
||||
|
||||
$(call reset)
|
||||
$(eval cflags += -I$D)
|
||||
|
||||
$(call yacc, $(OBJDIR)/$D, $D/mktab.y)
|
||||
|
||||
$(call flex, $(OBJDIR)/$D, $D/scan.l)
|
||||
$(call dependson, $(OBJDIR)/$D/y.tab.h)
|
||||
|
||||
$(call file, $(LIBEM_DATA))
|
||||
$(call file, -lfl)
|
||||
$(call cprogram, $D/mktab)
|
||||
|
||||
endef
|
||||
|
||||
define build-opt-impl
|
||||
|
||||
$(call reset)
|
||||
$(eval cflags += -I$D)
|
||||
$(call cfile, $D/main.c)
|
||||
$(call cfile, $D/getline.c)
|
||||
$(call cfile, $D/lookup.c)
|
||||
$(call cfile, $D/var.c)
|
||||
$(call cfile, $D/process.c)
|
||||
$(call cfile, $D/backward.c)
|
||||
$(call cfile, $D/util.c)
|
||||
$(call cfile, $D/alloc.c)
|
||||
$(call cfile, $D/putline.c)
|
||||
$(call cfile, $D/cleanup.c)
|
||||
$(call cfile, $D/peephole.c)
|
||||
$(call cfile, $D/flow.c)
|
||||
$(call cfile, $D/tes.c)
|
||||
$(call cfile, $D/reg.c)
|
||||
|
||||
$(eval CLEANABLES += $(OBJDIR)/$D/pop_push.c)
|
||||
$(OBJDIR)/$D/pop_push.c: $D/pop_push.awk h/em_table
|
||||
@echo POP_PUSH $$@
|
||||
@mkdir -p $$(dir $$@)
|
||||
$(hide) awk -f $D/pop_push.awk < h/em_table > $$@
|
||||
$(call cfile, $(OBJDIR)/$D/pop_push.c)
|
||||
|
||||
$(eval CLEANABLES += $(OBJDIR)/$D/pattern.c)
|
||||
$(OBJDIR)/$D/pattern.c: $D/mktab $(OBJDIR)/$D/patterns
|
||||
@echo PATTERNS $$@
|
||||
@mkdir -p $$(dir $$@)
|
||||
$(hide) $D/mktab < $(OBJDIR)/$D/patterns > $$@
|
||||
$(call cfile, $(OBJDIR)/$D/pattern.c)
|
||||
|
||||
$(eval CLEANABLES += $(OBJDIR)/$D/patterns)
|
||||
$(OBJDIR)/$D/patterns: $(CPPANSI) $D/patterns
|
||||
@echo PREPROCESS $$@
|
||||
@mkdir -p $$(dir $$@)
|
||||
$(hide) $(CPPANSI) < $D/patterns > $$@
|
||||
|
||||
$(call file, $(LIBEM_DATA))
|
||||
$(call file, $(LIBASSERT))
|
||||
$(call file, $(LIBPRINT))
|
||||
$(call file, $(LIBALLOC))
|
||||
$(call file, $(LIBSYSTEM))
|
||||
$(call file, $(LIBSTRING))
|
||||
|
||||
$(eval $q: $(INCDIR)/em_spec.h)
|
||||
|
||||
$(call cprogram, $(BINDIR)/em_opt)
|
||||
$(call installto, $(PLATDEP)/em_opt)
|
||||
$(eval EM_OPT := $o)
|
||||
|
||||
$(call reset)
|
||||
$(eval q := $D/em_opt.6)
|
||||
$(call installto, $(INSDIR)/share/man/man6/em_opt.6)
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(build-opt-mktab-impl))
|
||||
$(eval $(build-opt-impl))
|
||||
@@ -421,4 +421,3 @@ out(w) {
|
||||
}
|
||||
}
|
||||
|
||||
#include "scan.c"
|
||||
|
||||
@@ -11,6 +11,11 @@ static char rcsid2[] = "$Id$";
|
||||
*/
|
||||
|
||||
extern long atol();
|
||||
extern char patid[128];
|
||||
extern int lino;
|
||||
|
||||
#include "y.tab.h"
|
||||
|
||||
%}
|
||||
%%
|
||||
\"[^"]*\" { strncpy(patid,yytext,sizeof(patid)); return(STRING); }
|
||||
|
||||
Reference in New Issue
Block a user