rather than simply taking a list of modules on the command line. This allows significant
improvement of the behavior when used with Visual Studio, as the "old" way of doing this
with Visual Studio build files was to scan through the .c files; this brought up things
that were actually disabled in the build.
Also incorporate a patch by Charles Bailey to make the VC8 build less noisy, and allow use
of Win32 Bison if it's installed. Instructions updated as well.
svn path=/trunk/yasm/; revision=1642
EXTRA_DIST += Mkfiles/vc/re2c/run.bat
EXTRA_DIST += Mkfiles/vc/gap/gap.vcproj
EXTRA_DIST += Mkfiles/vc/gap/run.bat
+EXTRA_DIST += Mkfiles/vc8/bison.rules
+EXTRA_DIST += Mkfiles/vc8/crt_secure_no_deprecate.vsprops
EXTRA_DIST += Mkfiles/vc8/yasm.sln
EXTRA_DIST += Mkfiles/vc8/yasm.vcproj
EXTRA_DIST += Mkfiles/vc8/config.h
$(BUILDCC) -o $@ $<
module.c: libyasm/module.in genmodule
- ./genmodule libyasm/module.in $(YASM_MODULES)
+ ./genmodule libyasm/module.in Mkfiles/Makefile.dj
x86parse.c: modules/arch/x86/x86parse.gap gap
./gap modules/arch/x86/x86parse.gap $@
$(BUILDCC) -o $@ $<
module.c: libyasm/module.in genmodule
- ./genmodule libyasm/module.in $(YASM_MODULES)
+ ./genmodule libyasm/module.in Mkfiles/Makefile.flat
x86parse.c: modules/arch/x86/x86parse.gap gap
./gap modules/arch/x86/x86parse.gap $@
@echo off\r
cd ..\..\..\r
-echo "" >temp.txt\r
-for /R modules %%n in (*.c) do find "_LTX_" "%%n" | find "_module" | find "= {" >>temp.txt\r
-type temp.txt | %1 libyasm\module.in\r
-del temp.txt\r
+%1 libyasm\module.in Makefile.am\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<VisualStudioToolFile\r
+ Name="Bison"\r
+ Version="8.00"\r
+ >\r
+ <Rules>\r
+ <CustomBuildRule\r
+ Name="Bison"\r
+ DisplayName="Compiler compiler - bison"\r
+ CommandLine="bison [AllOptions] [AdditionalOptions] [inputs]"\r
+ Outputs="[$OutputStem].c;[$OutputStem].h"\r
+ FileExtensions="*.y"\r
+ ExecutionDescription="Executing bison..."\r
+ ShowOnlyRuleProperties="false"\r
+ >\r
+ <Properties>\r
+ <BooleanProperty\r
+ Name="OutputDefs"\r
+ DisplayName="Genereate extra .h file with parser defines"\r
+ Switch="-d"\r
+ DefaultValue="true"\r
+ />\r
+ <StringProperty\r
+ Name="OutputStem"\r
+ DisplayName="Output Stem"\r
+ Switch="-o "[value].c""\r
+ DefaultValue="$(InputDir)$(InputName)"\r
+ />\r
+ </Properties>\r
+ </CustomBuildRule>\r
+ </Rules>\r
+</VisualStudioToolFile>\r
#define yasm__abspath(path) yasm__abspath_win(path)\r
#define yasm__combpath(from, to) yasm__combpath_win(from, to)\r
\r
-#define _CRT_SECURE_NO_DEPRECATE 1\r
-\r
/* */\r
/* #undef ENABLE_NLS */\r
\r
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioPropertySheet\r
+ ProjectType="Visual C++"\r
+ Version="8.00"\r
+ Name="crt_secure_no_deprecate"\r
+ >\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE"\r
+ />\r
+</VisualStudioPropertySheet>\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
Version="8.00"\r
Name="genmodule"\r
ProjectGUID="{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}"\r
+ RootNamespace="genmodule"\r
Keyword="Win32Proj"\r
>\r
<Platforms>\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
@echo off\r
cd ..\..\..\r
-echo "" >temp.txt\r
-for /R modules %%n in (*.c) do find "_LTX_" "%%n" | find "_module" | find "= {" >>temp.txt\r
-type temp.txt | %1 libyasm\module.in\r
-del temp.txt\r
+%1 libyasm\module.in Makefile.am\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="4"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="4"\r
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="4"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="4"\r
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
RelativePath="..\..\..\libyasm\assocdat.c"\r
>\r
</File>\r
- <File\r
- RelativePath="..\..\..\libyasm\bitvect.c"\r
- >\r
- </File>\r
<File\r
RelativePath="..\..\..\libyasm\bc-align.c"\r
>\r
RelativePath="..\..\..\libyasm\bc-reserve.c"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\..\libyasm\bitvect.c"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\..\libyasm\bytecode.c"\r
>\r
>\r
</File>\r
</Filter>\r
+ <File\r
+ RelativePath="..\..\..\libyasm\module.in"\r
+ >\r
+ </File>\r
</Files>\r
<Globals>\r
</Globals>\r
/>\r
</Platforms>\r
<ToolFiles>\r
+ <ToolFile\r
+ RelativePath="..\bison.rules"\r
+ />\r
</ToolFiles>\r
<Configurations>\r
<Configuration\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="4"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
<Tool\r
Name="VCCustomBuildTool"\r
/>\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
<Tool\r
Name="VCXMLDataGeneratorTool"\r
/>\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="4"\r
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
<Tool\r
Name="VCCustomBuildTool"\r
/>\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
<Tool\r
Name="VCXMLDataGeneratorTool"\r
/>\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="4"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
<Tool\r
Name="VCCustomBuildTool"\r
/>\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
<Tool\r
Name="VCXMLDataGeneratorTool"\r
/>\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="4"\r
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
<Tool\r
Name="VCCustomBuildTool"\r
/>\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
<Tool\r
Name="VCXMLDataGeneratorTool"\r
/>\r
Name="dbgfmts"\r
>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\null\null-dbgfmt.c"\r
+ RelativePath="..\..\..\modules\dbgfmts\codeview\cv-dbgfmt.c"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\stabs\stabs-dbgfmt.c"\r
+ RelativePath="..\..\..\modules\dbgfmts\codeview\cv-dbgfmt.h"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\codeview\cv-dbgfmt.h"\r
+ RelativePath="..\..\..\modules\dbgfmts\codeview\cv-symline.c"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\codeview\cv-dbgfmt.c"\r
+ RelativePath="..\..\..\modules\dbgfmts\codeview\cv-type.c"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\codeview\cv-symline.c"\r
+ RelativePath="..\..\..\modules\dbgfmts\dwarf2\dwarf2-aranges.c"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\codeview\cv-type.c"\r
+ RelativePath="..\..\..\modules\dbgfmts\dwarf2\dwarf2-dbgfmt.c"\r
>\r
</File>\r
<File\r
>\r
</File>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\dwarf2\dwarf2-dbgfmt.c"\r
+ RelativePath="..\..\..\modules\dbgfmts\dwarf2\dwarf2-info.c"\r
>\r
</File>\r
<File\r
>\r
</File>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\dwarf2\dwarf2-info.c"\r
+ RelativePath="..\..\..\modules\dbgfmts\null\null-dbgfmt.c"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\..\modules\dbgfmts\dwarf2\dwarf2-aranges.c"\r
+ RelativePath="..\..\..\modules\dbgfmts\stabs\stabs-dbgfmt.c"\r
>\r
</File>\r
</Filter>\r
RelativePath="..\..\..\gas-bison.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\..\modules\parsers\gas\gas-bison.y"\r
+ >\r
+ <FileConfiguration\r
+ Name="Release|Win32"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ OutputStem="../../../gas-bison"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|x64"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Debug|Win32"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ OutputStem="../../../gas-bison"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Debug|x64"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
+ </FileConfiguration>\r
+ </File>\r
<File\r
RelativePath="..\..\..\modules\parsers\gas\gas-defs.h"\r
>\r
RelativePath="..\..\..\nasm-bison.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\..\modules\parsers\nasm\nasm-bison.y"\r
+ >\r
+ <FileConfiguration\r
+ Name="Release|Win32"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ OutputStem="../../../nasm-bison"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|x64"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Debug|Win32"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ OutputStem="../../../nasm-bison"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Debug|x64"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
+ </FileConfiguration>\r
+ </File>\r
<File\r
RelativePath="..\..\..\modules\parsers\nasm\nasm-defs.h"\r
>\r
/>\r
</Platforms>\r
<ToolFiles>\r
+ <ToolFile\r
+ RelativePath="..\bison.rules"\r
+ />\r
</ToolFiles>\r
<Configurations>\r
<Configuration\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
<Tool\r
Name="VCCustomBuildTool"\r
/>\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
<Tool\r
Name="VCXMLDataGeneratorTool"\r
/>\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets="..\crt_secure_no_deprecate.vsprops"\r
CharacterSet="2"\r
>\r
<Tool\r
<Tool\r
Name="VCCustomBuildTool"\r
/>\r
+ <Tool\r
+ Name="Bison"\r
+ />\r
<Tool\r
Name="VCXMLDataGeneratorTool"\r
/>\r
RelativePath="..\..\..\re2c-parser.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\..\tools\re2c\re2c-parser.y"\r
+ >\r
+ <FileConfiguration\r
+ Name="Debug|Win32"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ OutputStem="../../../re2c-parser"\r
+ />\r
+ </FileConfiguration>\r
+ <FileConfiguration\r
+ Name="Release|Win32"\r
+ ExcludedFromBuild="true"\r
+ >\r
+ <Tool\r
+ Name="Bison"\r
+ OutputStem="../../../re2c-parser"\r
+ />\r
+ </FileConfiguration>\r
+ </File>\r
<File\r
RelativePath="..\..\..\tools\re2c\scanner.c"\r
>\r
2. YASM Download\r
----------------\r
\r
-The following files are not built on VC++ and are not contained in the\r
-YASM subversion repository (but they are included in the nightly YASM\r
-snapshots):\r
+The following files are not built by default on VC++ and are not contained\r
+in the YASM subversion repository (but they are included in the nightly\r
+YASM snapshots):\r
\r
gas-bison.c\r
gas-bison.h\r
re2c-parser.c\r
re2c-parser.h\r
\r
+However, if you want to build these files from source, follow these step:\r
+ 1) Install bison. This can be done in a number of ways, the easiest is\r
+ probably to download and run the Win32 Bison Setup program from\r
+ http://gnuwin32.sourceforge.net/packages/bison.htm\r
+ 2) In Visual Studio, go to Tools|Options,\r
+ Projects and Solutions|VC++ Directories, and add the directory where\r
+ you installed Bison to the list of directories.\r
+ 3) For each of the .y files in the build, right click, select Properties,\r
+ and change the "Excluded From Build" setting to No. These files are:\r
+ re2c/Source Files/re2c-parser.y\r
+ modules/Source Files/gas-bison.y\r
+ modules/Source Files/nasm-bison.y\r
+\r
If you wish to build from the latest files in the subversion repository,\r
you will need to add these files from the latest snapshot to the repository\r
files. They should be placed in the YASM root directory.\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yasm", "yasm.vcproj", "{34EB1BEB-C2D6-4A52-82B7-7ACD714A30D5}"\r
ProjectSection(ProjectDependencies) = postProject\r
+ {021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459}\r
{29FE7874-1256-4AD6-B889-68E399DC9608} = {29FE7874-1256-4AD6-B889-68E399DC9608}\r
{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6} = {D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}\r
- {021CEB0A-F721-4F59-B349-9CEEAF244459} = {021CEB0A-F721-4F59-B349-9CEEAF244459}\r
EndProjectSection\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmacro", "genmacro\genmacro.vcproj", "{225700A5-07B8-434E-AD61-555278BF6733}"\r
EndProject\r
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{825AC694-358C-4D8D-92DE-33A2691978CE}"\r
ProjectSection(SolutionItems) = preProject\r
+ crt_secure_no_deprecate.vsprops = crt_secure_no_deprecate.vsprops\r
readme.vc8.txt = readme.vc8.txt\r
EndProjectSection\r
EndProject\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets=".\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;.\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
+ InheritedPropertySheets=".\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
ConfigurationType="1"\r
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;.\crt_secure_no_deprecate.vsprops"\r
UseOfMFC="0"\r
ATLMinimizesCRunTimeLibraryUsage="false"\r
CharacterSet="2"\r
libyasm_a_SOURCES += module.c
module.c: $(top_srcdir)/libyasm/module.in genmodule$(EXEEXT) Makefile
- $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in $(YASM_MODULES)
+ $(top_builddir)/genmodule$(EXEEXT) $(top_srcdir)/libyasm/module.in Makefile
BUILT_SOURCES += module.c
CLEANFILES += module.c
/* $Id$
*
- * Generate module.c from module.in and list of modules.
+ * Generate module.c from module.in and Makefile.am or Makefile.
*
* Copyright (C) 2004 Peter Johnson
*
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
+
+#include "compat-queue.h"
#define OUTPUT "module.c"
+#define MAXNAME 128
#define MAXLINE 1024
#define MAXMODULES 128
+#define MAXINCLUDES 256
+
+typedef struct include {
+ STAILQ_ENTRY(include) link;
+ char *filename;
+} include;
int
main(int argc, char *argv[])
FILE *in, *out;
char *str;
int i;
- int len;
+ size_t len;
char *strp;
char *modules[MAXMODULES];
int num_modules = 0;
+ STAILQ_HEAD(includehead, include) includes =
+ STAILQ_HEAD_INITIALIZER(includes);
+ include *inc;
+ int isam = 0;
+ int linecont = 0;
- if (argc < 2) {
- fprintf(stderr, "Usage: %s <file> [module_name ...]\n", argv[0]);
+ if (argc != 3) {
+ fprintf(stderr, "Usage: %s <module.in> <Makefile[.am]>\n", argv[0]);
return EXIT_FAILURE;
}
str = malloc(MAXLINE);
-#ifdef FILTERMODE
- while (fgets(str, MAXLINE, stdin)) {
- if (strlen(str) < 6)
- continue;
- modules[num_modules] = malloc(strlen(str+5)+1); /* excessive */
- strp = str+5; /* skip past the "yasm_" */
- i = 0;
- /* copy the module type */
- while (*strp != '_')
- modules[num_modules][i++] = *strp++;
- modules[num_modules][i++] = *strp++; /* copy the following _ */
- /* find the next _ */
- while (*strp++ != '_')
- {}
- /* copy it up until the next _ */
- do {
- modules[num_modules][i++] = *strp++;
- } while (*strp != '_');
- /* terminate string */
- modules[num_modules][i] = '\0';
- num_modules++;
- }
-#else
- num_modules = argc-2;
- for (i=2; i<argc; i++) {
- modules[i-2] = malloc(strlen(argv[i])+1);
- strcpy(modules[i-2], argv[i]);
+ /* Starting with initial input Makefile, look for include <file> or
+ * YASM_MODULES += <module>. Note this currently doesn't handle
+ * a relative starting path.
+ */
+ len = strlen(argv[2]);
+ inc = malloc(sizeof(include));
+ inc->filename = malloc(len+1);
+ strcpy(inc->filename, argv[2]);
+ STAILQ_INSERT_TAIL(&includes, inc, link);
+
+ isam = argv[2][len-2] == 'a' && argv[2][len-1] == 'm';
+
+ while (!STAILQ_EMPTY(&includes)) {
+ inc = STAILQ_FIRST(&includes);
+ STAILQ_REMOVE_HEAD(&includes, link);
+ in = fopen(inc->filename, "rt");
+ if (!in) {
+ fprintf(stderr, "Could not open `%s'.\n", inc->filename);
+ return EXIT_FAILURE;
+ }
+ free(inc->filename);
+ free(inc);
+
+ while (fgets(str, MAXLINE, in)) {
+ /* Strip off any trailing whitespace */
+ len = strlen(str);
+ strp = &str[len-1];
+ while (isspace(*strp)) {
+ *strp-- = '\0';
+ len--;
+ }
+
+ strp = str;
+
+ /* Skip whitespace */
+ while (isspace(*strp))
+ strp++;
+
+ /* Skip comments */
+ if (*strp == '#')
+ continue;
+
+ /* If line continuation, skip to continue copy */
+ if (linecont)
+ goto keepgoing;
+
+ /* Check for include if original input is .am file */
+ if (isam && strncmp(strp, "include", 7) == 0 && isspace(strp[7])) {
+ strp += 7;
+ while (isspace(*strp))
+ strp++;
+ /* Build new include and add to end of list */
+ inc = malloc(sizeof(include));
+ inc->filename = malloc(strlen(strp)+1);
+ strcpy(inc->filename, strp);
+ STAILQ_INSERT_TAIL(&includes, inc, link);
+ continue;
+ }
+
+ /* Check for YASM_MODULES = or += */
+ if (strncmp(strp, "YASM_MODULES", 12) != 0)
+ continue;
+ strp += 12;
+ while (isspace(*strp))
+ strp++;
+ if (strncmp(strp, "+=", 2) != 0 && *strp != '=')
+ continue;
+ if (*strp == '+')
+ strp++;
+ strp++;
+ while (isspace(*strp))
+ strp++;
+
+keepgoing:
+ /* Check for continuation */
+ if (str[len-1] == '\\') {
+ str[len-1] = '\0';
+ while (isspace(*strp))
+ *strp-- = '\0';
+ linecont = 1;
+ } else
+ linecont = 0;
+
+ while (*strp != '\0') {
+ /* Copy module name */
+ modules[num_modules] = malloc(MAXNAME);
+ len = 0;
+ while (*strp != '\0' && !isspace(*strp))
+ modules[num_modules][len++] = *strp++;
+ modules[num_modules][len] = '\0';
+ num_modules++;
+
+ while (isspace(*strp))
+ strp++;
+ }
+ }
+ fclose(in);
}
-#endif
out = fopen(OUTPUT, "wt");