Skip to content

Commit

Permalink
Updated the build process (fperrad++). Also added pred/succ builtins …
Browse files Browse the repository at this point in the history
…for better compatibility with 'joy' code.
  • Loading branch information
Jarrod committed Mar 8, 2009
1 parent 33619ae commit 44c4b1d
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 107 deletions.
12 changes: 12 additions & 0 deletions .gitignore
@@ -1,8 +1,20 @@
Makefile

*.pbc
*.c
*.o
*.obj
*.exe
*.iss
fun
installable_fun

*.patch
*.gz

man
*.tmp

src/gen_*.pir
src/parser/grammar.pg

Expand Down
56 changes: 50 additions & 6 deletions Configure.pl
Expand Up @@ -4,13 +4,57 @@
use warnings;
use 5.008;

my $build_dir = '../..';
my $hll = 'fun';
my $cmd = qq{$^X -Ilib tools/dev/reconfigure.pl --step=gen::languages --languages=$hll};
# Get a list of parrot-configs to invoke.
my @parrot_config_exe = (
'parrot/parrot_config',
'../../parrot_config',
'parrot_config',
);

print "Running '$cmd' in $build_dir\n";
chdir $build_dir;
`$cmd`
# Get configuration information from parrot_config
my %config = read_parrot_config(@parrot_config_exe);
unless (%config) {
die "Unable to locate parrot_config.";
}

# Create the Makefile using the information we just got
create_makefiles(%config);

sub read_parrot_config {
my @parrot_config_exe = @_;
my %config = ();
for my $exe (@parrot_config_exe) {
no warnings;
if (open my $PARROT_CONFIG, '-|', "$exe --dump") {
print "Reading configuration information from $exe\n";
while (<$PARROT_CONFIG>) {
$config{$1} = $2 if (/(\w+) => '(.*)'/);
}
close $PARROT_CONFIG;
last if %config;
}
}
%config;
}


# Generate Makefiles from a configuration
sub create_makefiles {
my %config = @_;
my %makefiles = (
'config/makefiles/root.in' => 'Makefile',
'config/makefiles/pmc.in' => 'src/pmc/Makefile',
'config/makefiles/ops.in' => 'src/ops/Makefile',
);
my $build_tool = $config{libdir} . $config{versiondir}
. '/tools/dev/gen_makefile.pl';

foreach my $template (keys %makefiles) {
my $makefile = $makefiles{$template};
print "Creating $makefile\n";
system($config{perl}, $build_tool, $template, $makefile);
}
}

# Local Variables:
# mode: cperl
Expand Down
14 changes: 5 additions & 9 deletions changes.yml
Expand Up @@ -25,11 +25,7 @@ Ignore:
Alts:
- compare: 'cmp'
rationale: Shorter, more common.
- succ: '++'
rationale: Shorter, more common.
- pred: '--'
rationale: Shorter, more common.


- ifinteger: 'ifint'
rationale: Shorter type name.
- iffloat: 'ifnum'
Expand All @@ -38,7 +34,7 @@ Alts:
rationale: Shorter type name.
- iflogical: 'ifbool'
rationale: Shorter type name.

- integer: 'int?'
rationale: More apparant it is a predicate.
- float: 'num?'
Expand All @@ -60,14 +56,14 @@ Alts:

- some: 'any'
rationale: Any/all 'feels' more right to me.

- putchars: 'puts'
rationale: Shorter, more common name.
- fputchars: 'fputs'
rationale: Consistant with the putchars change.
- fputstring: 'fputs'
rationale: Duplicate of a depreciated function.

- app2: 'unary2'
rationale: Duplicate function.
- app3: 'unary3'
Expand All @@ -77,7 +73,7 @@ Alts:

- formatf: 'format'
rationale: It was trivial to make format also take a float. formatf is a confusing function name anyway.

- setautoput: 'setdot'
rationale: Being able to set the action of the dot makes autoput unneeded.
- autoput: 'getdot'
Expand Down
92 changes: 92 additions & 0 deletions config/makefiles/ops.in
@@ -0,0 +1,92 @@
## $Id$

# values from parrot_config
VERSION_DIR := @versiondir@
INCLUDE_DIR := @includedir@$(VERSION_DIR)
LIB_DIR := @libdir@$(VERSION_DIR)
STAGING_DIR := ../../dynext
#STAGING_DIR := @build_dir@/runtime/parrot/dynext
#INSTALL_DIR := $(LIB_DIR)/languages/fun/dynext
INSTALL_DIR := $(LIB_DIR)/dynext

# Set up extensions
LOAD_EXT := @load_ext@
O := @o@

# Setup some commands
PERL := @perl@
RM_F := @rm_f@
CHMOD := @chmod@
CP := @cp@
MKPATH := @mkpath@
CC := @cc@ -c
LD := @ld@
LDFLAGS := @ldflags@ @ld_debug@ @rpath_blib@ @linkflags@
LD_LOAD_FLAGS := @ld_load_flags@
CFLAGS := @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
CC_OUT := @cc_o_out@
LD_OUT := @ld_out@
#IF(parrot_is_shared):LIBPARROT := @libparrot_ldflags@
#ELSE:LIBPARROT :=

OPS2C := $(PERL) $(LIB_DIR)/tools/build/ops2c.pl

INCLUDES := -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/pmc
LINKARGS := $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)

OPS_FILE := fun.ops

CLEANUPS := \
"*$(LOAD_EXT)" \
"*$(O)" \
"*.c" \
"*.h" \
"$(STAGING_DIR)/fun_ops*$(LOAD_EXT)"


all: staging

generate: $(OPS_FILE)
$(OPS2C) C --dynamic $(OPS_FILE)
$(OPS2C) CSwitch --dynamic $(OPS_FILE)
#IF(cg_flag): $(OPS2C) CGoto --dynamic $(OPS_FILE)
#IF(cg_flag): $(OPS2C) CGP --dynamic $(OPS_FILE)

compile: generate
$(CC) $(CC_OUT)fun_ops$(O) $(INCLUDES) $(CFLAGS) fun_ops.c
$(CC) $(CC_OUT)fun_ops_switch$(O) $(INCLUDES) $(CFLAGS) fun_ops_switch.c
#IF(cg_flag): $(CC) $(CC_OUT)fun_ops_cg$(O) $(INCLUDES) $(CFLAGS) fun_ops_cg.c
#IF(cg_flag): $(CC) $(CC_OUT)fun_ops_cgp$(O) $(INCLUDES) $(CFLAGS) fun_ops_cgp.c

linklibs: compile
$(LD) $(LD_OUT)fun_ops$(LOAD_EXT) fun_ops$(O) $(LINKARGS)
$(LD) $(LD_OUT)fun_ops_switch$(LOAD_EXT) fun_ops_switch$(O) $(LINKARGS)
#IF(cg_flag): $(LD) $(LD_OUT)fun_ops_cg$(LOAD_EXT) fun_ops_cg$(O) $(LINKARGS)
#IF(cg_flag): $(LD) $(LD_OUT)fun_ops_cgp$(LOAD_EXT) fun_ops_cgp$(O) $(LINKARGS)

staging: linklibs
#IF(cygwin or hpux): CHMOD 0775 "*$(LOAD_EXT)"
$(MKPATH) $(STAGING_DIR)
$(CP) "*$(LOAD_EXT)" $(STAGING_DIR)

install:
#IF(cygwin or hpux): CHMOD 0775 "*$(LOAD_EXT)"
$(CP) "*$(LOAD_EXT)" $(INSTALL_DIR)

uninstall:
$(RM_F) "$(INSTALL_DIR)/fun_ops*$(LOAD_EXT)"

Makefile: ../../config/makefiles/ops.in
cd ../.. && $(PERL) Configure.pl

clean:
$(RM_F) $(CLEANUPS)

realclean:
$(RM_F) $(CLEANUPS) Makefile

# Local variables:
# mode: makefile
# End:
# vim: ft=make:

119 changes: 119 additions & 0 deletions config/makefiles/pmc.in
@@ -0,0 +1,119 @@
## $Id$

# values from parrot_config
VERSION_DIR := @versiondir@
INCLUDE_DIR := @includedir@$(VERSION_DIR)
LIB_DIR := @libdir@$(VERSION_DIR)
SRC_DIR := @srcdir@$(VERSION_DIR)
TOOLS_DIR := @libdir@$(VERSION_DIR)/tools/lib
STAGING_DIR := ../../dynext
#STAGING_DIR := @build_dir@/runtime/parrot/dynext
#INSTALL_DIR := $(LIB_DIR)/languages/fun/dynext
INSTALL_DIR := $(LIB_DIR)/dynext

# Set up extensions
LOAD_EXT := @load_ext@
O := @o@

# Setup some commands
PERL := @perl@
RM_F := @rm_f@
CHMOD := @chmod@
CP := @cp@
MKPATH := @mkpath@
CC := @cc@ -c
LD := @ld@
LDFLAGS := @ldflags@ @ld_debug@
LD_LOAD_FLAGS := @ld_load_flags@
CFLAGS := @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
CC_OUT := @cc_o_out@
LD_OUT := @ld_out@
#IF(parrot_is_shared):LIBPARROT := @libparrot_ldflags@
#ELSE:LIBPARROT :=

PMC2C_INCLUDES := --include $(SRC_DIR) --include $(SRC_DIR)/pmc
PMC2C := $(PERL) $(LIB_DIR)/tools/build/pmc2c.pl
PMC2CD := $(PMC2C) --dump $(PMC2C_INCLUDES)
PMC2CC := $(PMC2C) --c $(PMC2C_INCLUDES)

INCLUDES := -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/pmc
LINKARGS := $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)

FUN_GROUP := fun_group

PMC_SOURCES := \
list.pmc \
delayedsub.pmc \
char.pmc \
eosmarker.pmc

OBJS := \
lib-$(FUN_GROUP)$(O) \
list$(O) \
delayedsub$(O) \
char$(O) \
eosmarker$(O)

CLEANUPS := \
"*$(LOAD_EXT)" \
"*$(O)" \
"*.c" \
"*.h" \
"*.dump" \
#IF(win32): "*.exp" \
#IF(win32): "*.ilk" \
#IF(win32): "*.manifext" \
#IF(win32): "*.pdb" \
#IF(win32): "*.lib" \
$(STAGING_DIR)/$(FUN_GROUP)$(LOAD_EXT)


all: staging

generate: $(PMC_SOURCES)
$(PMC2CD) list.pmc
$(PMC2CD) delayedsub.pmc
$(PMC2CD) char.pmc
$(PMC2CD) eosmarker.pmc
$(PMC2CC) list.pmc
$(PMC2CC) delayedsub.pmc
$(PMC2CC) char.pmc
$(PMC2CC) eosmarker.pmc
$(PMC2C) --library $(FUN_GROUP) --c $(PMC_SOURCES)

compile: generate
$(CC) $(CC_OUT)list$(O) $(INCLUDES) $(CFLAGS) list.c
$(CC) $(CC_OUT)delayedsub$(O) $(INCLUDES) $(CFLAGS) delayedsub.c
$(CC) $(CC_OUT)char$(O) $(INCLUDES) $(CFLAGS) char.c
$(CC) $(CC_OUT)eosmarker$(O) $(INCLUDES) $(CFLAGS) eosmarker.c
$(CC) $(CC_OUT)lib-$(FUN_GROUP)$(O) $(INCLUDES) $(CFLAGS) $(FUN_GROUP).c

linklibs: compile
$(LD) $(LD_OUT)$(FUN_GROUP)$(LOAD_EXT) $(OBJS) $(LINKARGS)

staging: linklibs
#IF(cygwin or hpux): CHMOD 0775 "*$(LOAD_EXT)"
$(MKPATH) $(STAGING_DIR)
$(CP) "*$(LOAD_EXT)" $(STAGING_DIR)

install:
#IF(cygwin or hpux): CHMOD 0775 "*$(LOAD_EXT)"
$(CP) "*$(LOAD_EXT)" $(INSTALL_DIR)

uninstall:
$(RM_F) $(INSTALL_DIR)/$(FUN_GROUP)$(LOAD_EXT)

Makefile: ../../config/makefiles/pmc.in
cd ../.. && $(PERL) Configure.pl

clean:
$(RM_F) $(CLEANUPS)

realclean:
$(RM_F) $(CLEANUPS) Makefile

# Local variables:
# mode: makefile
# End:
# vim: ft=make:

0 comments on commit 44c4b1d

Please sign in to comment.