mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
misc/emacstbl.pl: add NASM version to output, add to Makefile
Include the version number in the output (misc/nasmtok.el) and add a rule for generating it to the Makefiles. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
b58771d827
commit
2d5cf17130
@ -195,6 +195,7 @@ PERLREQ = config/unconfig.h \
|
||||
macros/macros.c \
|
||||
asm/pptok.ph asm/directbl.c asm/directiv.h \
|
||||
asm/warnings.c include/warnings.h doc/warnings.src \
|
||||
misc/nasmtok.el \
|
||||
version.h version.mac version.mak nsis/version.nsh
|
||||
|
||||
INSDEP = x86/insns.dat x86/insns.pl x86/insns-iflags.ph x86/iflags.ph
|
||||
@ -336,6 +337,11 @@ asm/directbl.c: asm/directiv.dat nasmlib/perfhash.pl perllib/phash.ph
|
||||
$(RUNPERL) $(srcdir)/nasmlib/perfhash.pl c \
|
||||
$(srcdir)/asm/directiv.dat asm/directbl.c
|
||||
|
||||
# Emacs token files
|
||||
misc/nasmtok.el: misc/emacstbl.pl asm/tokhash.c asm/pptok.c \
|
||||
asm/directiv.dat version
|
||||
$(RUNPERL) $< $@ "$(srcdir)" "$(objdir)"
|
||||
|
||||
#-- End Generated File Rules --#
|
||||
|
||||
perlreq: $(PERLREQ)
|
||||
|
@ -154,6 +154,7 @@ PERLREQ = config\unconfig.h \
|
||||
macros\macros.c \
|
||||
asm\pptok.ph asm\directbl.c asm\directiv.h \
|
||||
asm\warnings.c include\warnings.h doc\warnings.src \
|
||||
misc\nasmtok.el \
|
||||
version.h version.mac version.mak nsis\version.nsh
|
||||
|
||||
INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph x86\iflags.ph
|
||||
@ -295,6 +296,11 @@ asm\directbl.c: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
|
||||
$(RUNPERL) $(srcdir)\nasmlib\perfhash.pl c \
|
||||
$(srcdir)\asm\directiv.dat asm\directbl.c
|
||||
|
||||
# Emacs token files
|
||||
misc\nasmtok.el: misc\emacstbl.pl asm\tokhash.c asm\pptok.c \
|
||||
asm\directiv.dat version
|
||||
$(RUNPERL) $< $@ "$(srcdir)" "$(objdir)"
|
||||
|
||||
#-- End Generated File Rules --#
|
||||
|
||||
perlreq: $(PERLREQ)
|
||||
|
@ -167,6 +167,7 @@ PERLREQ = config\unconfig.h &
|
||||
macros\macros.c &
|
||||
asm\pptok.ph asm\directbl.c asm\directiv.h &
|
||||
asm\warnings.c include\warnings.h doc\warnings.src &
|
||||
misc\nasmtok.el &
|
||||
version.h version.mac version.mak nsis\version.nsh
|
||||
|
||||
INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph x86\iflags.ph
|
||||
@ -308,6 +309,11 @@ asm\directbl.c: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
|
||||
$(RUNPERL) $(srcdir)\nasmlib\perfhash.pl c &
|
||||
$(srcdir)\asm\directiv.dat asm\directbl.c
|
||||
|
||||
# Emacs token files
|
||||
misc\nasmtok.el: misc\emacstbl.pl asm\tokhash.c asm\pptok.c &
|
||||
asm\directiv.dat version
|
||||
$(RUNPERL) $< $@ "$(srcdir)" "$(objdir)"
|
||||
|
||||
#-- End Generated File Rules --#
|
||||
|
||||
perlreq: $(PERLREQ) .SYMBOLIC
|
||||
|
@ -31,6 +31,8 @@ my %override = ( 'id' => 'special',
|
||||
'floatize' => 'function',
|
||||
'strfunc' => 'function',
|
||||
'ifunc' => 'function',
|
||||
'insn' => 'instruction',
|
||||
'reg' => 'register',
|
||||
'seg' => 'special',
|
||||
'wrt' => 'special' );
|
||||
|
||||
@ -124,6 +126,18 @@ sub read_directiv_dat($) {
|
||||
close($dd);
|
||||
}
|
||||
|
||||
my $version;
|
||||
sub read_version($) {
|
||||
my($vfile) = @_;
|
||||
open(my $v, '<', $vfile)
|
||||
or die "$0:$vfile: $!\n";
|
||||
|
||||
$version = <$v>;
|
||||
chomp $version;
|
||||
|
||||
close($v);
|
||||
}
|
||||
|
||||
sub make_lines($$@) {
|
||||
my $maxline = shift @_;
|
||||
my $indent = shift @_;
|
||||
@ -171,12 +185,23 @@ sub write_output($) {
|
||||
open(my $out, '>', $outfile)
|
||||
or die "$0:$outfile: $!\n";
|
||||
|
||||
my($vol,$dir,$file) = File::Spec->splitpath($outfile);
|
||||
|
||||
print $out ";;; ${file} --- lists of NASM assembler tokens\n";
|
||||
print $out ";;;\n";
|
||||
print $out ";;; This file contains list of tokens from the NASM x86\n";
|
||||
print $out ";;; assembler, automatically extracted from NASM ${version}.\n";
|
||||
print $out ";;;\n";
|
||||
print $out ";;; This file is intended to be (require)d from a `nasm-mode\'\n";
|
||||
print $out ";;; major mode definition.\n";
|
||||
|
||||
foreach my $type (sort keys(%tokens)) {
|
||||
print $out "(defconst nasm-${type}\n";
|
||||
print $out "\n(defconst nasm-${type}\n";
|
||||
print $out " \'(";
|
||||
|
||||
print $out make_lines(78, 4, quote_for_emacs(sort @{$tokens{$type}}));
|
||||
print $out "))\n";
|
||||
print $out ")\n";
|
||||
print $out " \"NASM ${version} ${type} tokens for `nasm-mode\'.\")\n";
|
||||
}
|
||||
|
||||
close($out);
|
||||
@ -185,5 +210,6 @@ sub write_output($) {
|
||||
read_tokhash_c(File::Spec->catfile($objdir, 'asm', 'tokhash.c'));
|
||||
read_pptok_c(File::Spec->catfile($objdir, 'asm', 'pptok.c'));
|
||||
read_directiv_dat(File::Spec->catfile($srcdir, 'asm', 'directiv.dat'));
|
||||
read_version(File::Spec->catfile($srcdir, 'version'));
|
||||
|
||||
write_output($outfile);
|
||||
|
Loading…
Reference in New Issue
Block a user