# New Ticket Created by Leopold Toetsch # Please include the string: [perl #24080] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24080 >
Attached is a first attempt to prepare for the move of languages/imcc to imcc and to build a single parrot executable. The patch doesn't address languages/* yet, only parrot/imcc are involved. Changes: - imcc makefile rules and targets are included in root now - libparrot contains imcc objects too (except main of course) - imcc test system is adapted to run with the parrot executable Known issues: - Building of imcc in its own directory is broken (this will very probably be abandoned anyway - except Melvin, the original author of imcc, loudly hollers - it could be a dummy to just copy parrot). - languages like perl6, which are still using imcc$(EXE) will be addressed by another patch. - "make realclean" deletes generated parser/lexer files too (which it probably shouldn't) - regenerating these files may be broken. Status - Runs "make test" (incl. test_imcc) on i386/linux here. The only problematic thing AFAIK might be the automatic rule in root.in:594 that includes the private imcc headers for building IMCC_O_FILES. I don't know if other makes are capable of "info make" "Syntax of Static Pattern Rules". If not, we probably have to expand these to explicit rules. Please give it a try. Feedback very welcome TIA leo -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/65508/48841/d5cfd7/parrot-build-1.patch
--- parrot/config/gen/cflags/root.in Tue Jul 22 16:56:43 2003 +++ parrot-leo/config/gen/cflags/root.in Wed Oct 1 09:10:30 2003 @@ -7,3 +7,7 @@ # spf_render.c -{-Wformat-nonliteral} # noisy tsq.c -{${optimize}} # never optimize tsq.c! + +# imcc file settings +{imcc} -{-Wwrite-strings -Wcast-qual} s/-Wno-unused/-Wunused/ -{-Wformat-nonliteral} + --- parrot/config/gen/makefiles/root.in Tue Sep 30 16:26:09 2003 +++ parrot-leo/config/gen/makefiles/root.in Wed Oct 1 10:24:22 2003 @@ -8,13 +8,13 @@ INCLUDEDIR = $(EXEC_PREFIX)/include # imcc dir -IMCC_DIR = languages/imcc +IMCC_DIR = languages${slash}imcc + # file containing main -PARROT_MAIN = test_main +PARROT_MAIN = $(IMCC_DIR)${slash}main -O = ${o} -SO = ${so} -A = ${a} + +# programs and utils used for build RM_F = ${rm_f} RM_RF = ${rm_rf} AR_CR = ${ar} ${ar_flags} @@ -22,9 +22,18 @@ LINK = ${link} LD = ${ld} LD_SHARED = ${ld_shared} +TOUCH = perl -e ${PQ}open(A,q{>>},$$_) or die foreach @ARGV${PQ} +YACC = ${yacc} +LEX = ${lex} + +# file extensions and util flags +O = ${o} +SO = ${so} +A = ${a} LD_OUT = ${ld_out} LD_SHARED_FLAGS=${ld_shared_flags} + INC=./${inc} NONGEN_HEADERS = ${nongen_headers} @@ -96,6 +105,36 @@ # ############################################################################### +# these are private to the imcc subsystem +IMCC_H_FILES = \ + $(IMCC_DIR)${slash}imc.h \ + $(IMCC_DIR)${slash}stacks.h \ + $(IMCC_DIR)${slash}cfg.h \ + $(IMCC_DIR)${slash}instructions.h \ + $(IMCC_DIR)${slash}debug.h \ + $(IMCC_DIR)${slash}sets.h \ + $(IMCC_DIR)${slash}symreg.h \ + $(IMCC_DIR)${slash}pbc.h \ + $(IMCC_DIR)${slash}optimizer.h \ + $(IMCC_DIR)${slash}parser.h \ + $(IMCC_DIR)${slash}imcparser.h + +IMCC_O_FILES = \ + $(IMCC_DIR)${slash}imcparser$(O) \ + $(IMCC_DIR)${slash}imclexer$(O) \ + $(IMCC_DIR)${slash}imc$(O) \ + $(IMCC_DIR)${slash}stacks$(O) \ + $(IMCC_DIR)${slash}symreg$(O) \ + $(IMCC_DIR)${slash}instructions$(O) \ + $(IMCC_DIR)${slash}cfg$(O) \ + $(IMCC_DIR)${slash}sets$(O) \ + $(IMCC_DIR)${slash}debug$(O) \ + $(IMCC_DIR)${slash}optimizer$(O) \ + $(IMCC_DIR)${slash}pbc$(O) \ + $(IMCC_DIR)${slash}parser_util$(O) \ + $(IMCC_DIR)${slash}jit$(O) \ + $(IMCC_DIR)${slash}pcc$(O) + GENERAL_H_FILES = $(NONGEN_HEADERS) $(GEN_HEADERS) ${cg_h} @@ -113,7 +152,7 @@ IO_O_FILES = io/io$(O) io/io_buf$(O) io/io_unix$(O) io/io_win32$(O) \ io/io_stdio$(O) io/io_passdown$(O) -INTERP_O_FILES = exceptions$(O) global_setup$(O) interpreter$(O) parrot$(O) \ +INTERP_O_FILES = exceptions$(O) global_setup$(O) interpreter$(O) \ register$(O) core_ops$(O) core_ops_prederef$(O) core_ops_switch$(O) \ memory$(O) objects$(O) ${exec_o} \ packfile$(O) stacks$(O) string$(O) sub$(O) encoding$(O) \ @@ -128,7 +167,8 @@ dynext$(O) utils$(O) vtables$(O) mmd$(O) O_FILES = $(INTERP_O_FILES) $(IO_O_FILES) $(CLASS_O_FILES) \ - $(ENCODING_O_FILES) $(CHARTYPE_O_FILES) + $(ENCODING_O_FILES) $(CHARTYPE_O_FILES) \ + $(IMCC_O_FILES) OPS_FILES = ${ops} $(GEN_OPSFILES) @@ -170,8 +210,6 @@ PINFO = pbc_info${exe} PDB = pdb${exe} -IMCC_PROG = languages/imcc/imcc${exe} - # lclint has changed name to splint at v3.0 LINT = splint @@ -201,7 +239,7 @@ .c$(O) : @$(PERL) tools/dev/cc_flags.pl ./CFLAGS $(CC) $(CFLAGS) ${cc_o_out}$@ -c $< -all : flags_dummy $(TEST_PROG) $(IMCC_PROG) docs +all : flags_dummy $(TEST_PROG) docs world: all parrot_utils @@ -216,7 +254,6 @@ $(TEST_PROG) : $(PARROT_MAIN)$(O) $(GEN_HEADERS) $(LIBPARROT) lib/Parrot/OpLib/core.pm $(LINK) ${ld_out}$(TEST_PROG) $(LINKFLAGS) $(PARROT_MAIN)$(O) $(LIBPARROT) $(C_LIBS) - $(PERL) -MExtUtils::Command -e mv $(TEST_PROG) test_main$(EXE) lib_deps_object : $(O_FILES) $(PERL) tools/dev/lib_deps.pl object $(O_FILES) @@ -539,6 +576,26 @@ exec_cpu.c: lib/Parrot/OpLib/core.pm $(INC)/jit_emit.h jit/${jitcpuarch}/core.jit ${exec_h} $(INC)/exec_dep.h $(PERL) jit2h.pl ${jitcpuarch} exec_cpu.c +######## imcc files deps +# +# The .flag files are needed because we are keeping some derived files in CVS, +# which does not keep accurate timestamps on the files, relative to each other. +# Note that YACC or LEX may be null commands, so we must `touch` all the +# target files, instead of just the .flag files. + +$(IMCC_DIR)${slash}imcc.y.flag $(IMCC_DIR)${slash}imcparser.c $(IMCC_DIR)${slash}imcparser.h: $(IMCC_DIR)${slash}imcc.y + $(YACC) $(IMCC_DIR)${slash}imcc.y -d -o $(IMCC_DIR)${slash}imcparser.c + $(TOUCH) $(IMCC_DIR)${slash}imcc.y.flag $(IMCC_DIR)${slash}imcparser.c $(IMCC_DIR)${slash}imcparser.h + +$(IMCC_DIR)${slash}imcc.l.flag $(IMCC_DIR)${slash}imclexer.c: $(IMCC_DIR)${slash}imcc.l + $(LEX) -o$(IMCC_DIR)${slash}inclexer.o $(IMCC_DIR)${slash}imcc.l + $(TOUCH) $(IMCC_DIR)${slash}imcc.l.flag $(IMCC_DIR)${slash}imclexer.c + +$(IMCC_O_FILES) : %${o} :%.c $(IMCC_H_FILES) $(ALL_H_FILES) + $(PERL) tools/dev/cc_flags.pl ./CFLAGS $(CC) -I$(IMCC_DIR) $(CFLAGS) ${cc_o_out}$@ -c $< + +################ docs, test and maintainer targets + docs : docs/.dummy docs/.dummy : @@ -558,19 +615,6 @@ cd classes && $(MAKE) && cd .. -$(IMCC_PROG) : $(LIBPARROT) \ - languages/imcc/*.c \ - languages/imcc/*.h \ - languages/imcc/*.y \ - languages/imcc/*.l - cd languages${slash}imcc && $(MAKE) && cd ..${slash}.. - $(PERL) -MExtUtils::Command -e mv $(IMCC_PROG) $(TEST_PROG) - cd languages${slash}imcc && $(MAKE) && cd ..${slash}.. - -# the chmod doesn't work here, so move imcc and make it again :-( -# $(PERL) -MExtUtils::Command -e chmod 0755 $(TEST_PROG) - - ############################################################################### # # Testing Targets: @@ -602,7 +646,7 @@ $(PERL) t/harness $(EXTRA_TEST_ARGS) -b $(TEST_PROG_ARGS) quick # Common prep for all test targets -test_prep : $(LIBPARROT) $(IMCC_PROG) +test_prep : $(LIBPARROT) $(TEST_PROG) test_dummy : $(PERL) t/harness $(EXTRA_TEST_ARGS) $(TEST_PROG_ARGS) @@ -629,13 +673,13 @@ $(TEST_PROG) $(TEST_PROG_ARGS) examples/assembly/life.pbc test_imcc : - cd languages/imcc && $(PERL) t/harness && cd ../.. + cd $(IMCC_DIR) && $(PERL) t/harness && cd ../.. fulltest_imcc : - cd languages/imcc && $(PERL) t/harness && cd ../.. - cd languages/imcc && $(PERL) t/harness -j && cd ../.. - cd languages/imcc && $(PERL) t/harness -P && cd ../.. - cd languages/imcc && $(PERL) t/harness -b && cd ../.. + cd $(IMCC_DIR) && $(PERL) t/harness && cd ../.. + cd $(IMCC_DIR) && $(PERL) t/harness -j && cd ../.. + cd $(IMCC_DIR) && $(PERL) t/harness -P && cd ../.. + cd $(IMCC_DIR) && $(PERL) t/harness -b && cd ../.. # For reporting success or failure with different configurations ok: --- parrot/languages/imcc/TestCompiler.pm Fri Aug 1 12:14:45 2003 +++ parrot-leo/languages/imcc/TestCompiler.pm Wed Oct 1 10:17:36 2003 @@ -89,9 +89,9 @@ my $TEST_PROG_ARGS = $ENV{TEST_PROG_ARGS} || ''; my $s = $PConfig{slash}; - my $IMCC = $ENV{IMCC} || ".${s}imcc"; + my $exe = $PConfig{exe}; + my $IMCC = $ENV{IMCC} || "..${s}..${s}parrot$exe"; # XXX # If $ENV{IMCC} is set from root Makefile, adjust the path. - $IMCC =~ s{^languages[/\\]imcc}{.}; if ($gen_pasm) { $TEST_PROG_ARGS =~ s/-O.//; --- parrot/languages/imcc/t/syn/file.t Mon Sep 22 17:01:50 2003 +++ parrot-leo/languages/imcc/t/syn/file.t Wed Oct 1 10:20:04 2003 @@ -4,6 +4,8 @@ use lib '../../lib'; use Parrot::Config; +my $PARROT = "..$PConfig{slash}..$PConfig{slash}parrot$PConfig{exe}"; + # include file tests ############################## @@ -142,7 +144,7 @@ close FOO; # compile it -system(".$PConfig{slash}imcc$PConfig{exe} -o temp.pbc temp.imc"); +system("$PARROT -o temp.pbc temp.imc"); output_is(<<'CODE', <<'OUT', "call sub in external pbc"); .pcc_sub _sub1 prototyped @@ -176,7 +178,7 @@ close FOO; # compile it -system(".$PConfig{slash}imcc$PConfig{exe} -o temp.pbc temp.imc"); +system("$PARROT -o temp.pbc temp.imc"); output_is(<<'CODE', <<'OUT', "call sub in external pbc, return"); .pcc_sub _sub1 prototyped @@ -215,7 +217,7 @@ close FOO; # compile it -system(".$PConfig{slash}imcc$PConfig{exe} -o temp.pbc temp.imc"); +system("$PARROT -o temp.pbc temp.imc"); output_is(<<'CODE', <<'OUT', "call sub in external pbc with 2 subs"); .pcc_sub _sub1 prototyped @@ -368,10 +370,10 @@ close FOO; # compile it -system(".$PConfig{slash}imcc$PConfig{exe} -o temp.pbc temp.imc"); +system("$PARROT -o temp.pbc temp.imc"); use Test::More; -is(`.$PConfig{slash}imcc$PConfig{exe} temp.pbc`, <<OUT, "call internal sub like external, precompiled"); +is(`$PARROT temp.pbc`, <<OUT, "call internal sub like external, precompiled"); sub1 sub2 back