# How to compile:
# make -fMkfiles/Makefile.dj
-CFLAGS=-DHAVE_CONFIG_H -DWIN32 -IMkfiles/dj -O2 -I. -Ifrontends/yasm
+CFLAGS=-DHAVE_CONFIG_H -IMkfiles/dj -O2 -I. -Ifrontends/yasm
CC=gcc
all: yasm
libyasm/symrec.o \
libyasm/valparam.o \
libyasm/xmalloc.o \
- libyasm/xstrdup.o
+ libyasm/xstrdup.o \
+ module.o
MODULES_ARCH_X86_OBJS= \
modules/arch/x86/x86arch.o \
$(MODULES_ARCH_LC3B_OBJS)
MODULES_DBGFMTS_OBJS= \
- modules/dbgfmts/null/null-dbgfmt.o
+ modules/dbgfmts/null/null-dbgfmt.o \
+ modules/dbgfmts/stabs/stabs-dbgfmt.o
MODULES_LISTFMTS_OBJS= \
modules/listfmts/nasm/nasm-listfmt.o
YASM_OBJS= \
frontends/yasm/yasm.o \
- Mkfiles/vc/yasm-module.o \
frontends/yasm/yasm-options.o \
$(LIBYASM_OBJS) \
$(MODULES_OBJS)
# CFLAGS appropriately, along with writing a config.h for the platform and
# placing it in a libyasm subdirectory.
-CFLAGS=-DHAVE_CONFIG_H -DWIN32 -IMkfiles -I. -Ifrontends/yasm
+CFLAGS=-DHAVE_CONFIG_H -IMkfiles -I. -Ifrontends/yasm
CC=gcc
all: yasm
libyasm/symrec.o \
libyasm/valparam.o \
libyasm/xmalloc.o \
- libyasm/xstrdup.o
+ libyasm/xstrdup.o \
+ module.o
MODULES_ARCH_X86_OBJS= \
modules/arch/x86/x86arch.o \
$(MODULES_ARCH_LC3B_OBJS)
MODULES_DBGFMTS_OBJS= \
- modules/dbgfmts/null/null-dbgfmt.o
+ modules/dbgfmts/null/null-dbgfmt.o \
+ modules/dbgfmts/stabs/stabs-dbgfmt.o
MODULES_LISTFMTS_OBJS= \
modules/listfmts/nasm/nasm-listfmt.o
YASM_OBJS= \
frontends/yasm/yasm.o \
- Mkfiles/vc/yasm-module.o \
frontends/yasm/yasm-options.o \
$(LIBYASM_OBJS) \
$(MODULES_OBJS)
--- /dev/null
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+ ProjectType="Visual C++"\r
+ Version="7.10"\r
+ Name="genmodule"\r
+ ProjectGUID="{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}"\r
+ Keyword="Win32Proj">\r
+ <Platforms>\r
+ <Platform\r
+ Name="Win32"/>\r
+ </Platforms>\r
+ <Configurations>\r
+ <Configuration\r
+ Name="Debug|Win32"\r
+ OutputDirectory="Debug"\r
+ IntermediateDirectory="Debug"\r
+ ConfigurationType="1"\r
+ CharacterSet="2">\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ Optimization="0"\r
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+ MinimalRebuild="TRUE"\r
+ BasicRuntimeChecks="3"\r
+ RuntimeLibrary="5"\r
+ UsePrecompiledHeader="3"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="TRUE"\r
+ DebugInformationFormat="4"/>\r
+ <Tool\r
+ Name="VCCustomBuildTool"/>\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ OutputFile="$(OutDir)/genmodule.exe"\r
+ LinkIncremental="2"\r
+ GenerateDebugInformation="TRUE"\r
+ ProgramDatabaseFile="$(OutDir)/genmodule.pdb"\r
+ SubSystem="1"\r
+ TargetMachine="1"/>\r
+ <Tool\r
+ Name="VCMIDLTool"/>\r
+ <Tool\r
+ Name="VCPostBuildEventTool"/>\r
+ <Tool\r
+ Name="VCPreBuildEventTool"/>\r
+ <Tool\r
+ Name="VCPreLinkEventTool"/>\r
+ <Tool\r
+ Name="VCResourceCompilerTool"/>\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"/>\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"/>\r
+ <Tool\r
+ Name="VCWebDeploymentTool"/>\r
+ <Tool\r
+ Name="VCManagedWrapperGeneratorTool"/>\r
+ <Tool\r
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+ </Configuration>\r
+ <Configuration\r
+ Name="Release|Win32"\r
+ OutputDirectory="Release"\r
+ IntermediateDirectory="Release"\r
+ ConfigurationType="1"\r
+ CharacterSet="2">\r
+ <Tool\r
+ Name="VCCLCompilerTool"\r
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FILTERMODE"\r
+ RuntimeLibrary="4"\r
+ UsePrecompiledHeader="2"\r
+ WarningLevel="3"\r
+ Detect64BitPortabilityProblems="TRUE"\r
+ DebugInformationFormat="3"/>\r
+ <Tool\r
+ Name="VCCustomBuildTool"/>\r
+ <Tool\r
+ Name="VCLinkerTool"\r
+ OutputFile="$(OutDir)/genmodule.exe"\r
+ LinkIncremental="1"\r
+ GenerateDebugInformation="TRUE"\r
+ SubSystem="1"\r
+ OptimizeReferences="2"\r
+ EnableCOMDATFolding="2"\r
+ TargetMachine="1"/>\r
+ <Tool\r
+ Name="VCMIDLTool"/>\r
+ <Tool\r
+ Name="VCPostBuildEventTool"\r
+ CommandLine="run.bat $(TargetPath)"/>\r
+ <Tool\r
+ Name="VCPreBuildEventTool"/>\r
+ <Tool\r
+ Name="VCPreLinkEventTool"/>\r
+ <Tool\r
+ Name="VCResourceCompilerTool"/>\r
+ <Tool\r
+ Name="VCWebServiceProxyGeneratorTool"/>\r
+ <Tool\r
+ Name="VCXMLDataGeneratorTool"/>\r
+ <Tool\r
+ Name="VCWebDeploymentTool"/>\r
+ <Tool\r
+ Name="VCManagedWrapperGeneratorTool"/>\r
+ <Tool\r
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+ </Configuration>\r
+ </Configurations>\r
+ <References>\r
+ </References>\r
+ <Files>\r
+ <Filter\r
+ Name="Source Files"\r
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">\r
+ <File\r
+ RelativePath="..\..\..\libyasm\genmodule.c">\r
+ </File>\r
+ </Filter>\r
+ <Filter\r
+ Name="Header Files"\r
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">\r
+ </Filter>\r
+ <Filter\r
+ Name="Resource Files"\r
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"\r
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">\r
+ </Filter>\r
+ </Files>\r
+ <Globals>\r
+ </Globals>\r
+</VisualStudioProject>\r
--- /dev/null
+@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
BasicRuntimeChecks="3"/>\r
</FileConfiguration>\r
</File>\r
+ <File\r
+ RelativePath="..\..\..\module.c">\r
+ </File>\r
<File\r
RelativePath="..\..\..\libyasm\objfmt.c">\r
</File>\r
Microsoft Visual Studio Solution File, Format Version 8.00\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libyasm", "libyasm\libyasm.vcproj", "{29FE7874-1256-4AD6-B889-68E399DC9608}"\r
ProjectSection(ProjectDependencies) = postProject\r
+ {F0E8B707-00C5-4FF2-B8EF-7C39817132A0} = {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}\r
EndProjectSection\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modules", "modules\modules.vcproj", "{D715A3D4-EFAA-442E-AD8B-5B4FF64E1DD6}"\r
ProjectSection(ProjectDependencies) = postProject\r
EndProjectSection\r
EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmodule", "genmodule\genmodule.vcproj", "{F0E8B707-00C5-4FF2-B8EF-7C39817132A0}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ EndProjectSection\r
+EndProject\r
Global\r
GlobalSection(SolutionConfiguration) = preSolution\r
Debug = Debug\r
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Debug.Build.0 = Debug|Win32\r
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Release.ActiveCfg = Release|Win32\r
{3C58BE13-50A3-4583-984D-D8902B3D7713}.Release.Build.0 = Release|Win32\r
+ {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug.ActiveCfg = Debug|Win32\r
+ {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Debug.Build.0 = Debug|Win32\r
+ {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release.ActiveCfg = Release|Win32\r
+ {F0E8B707-00C5-4FF2-B8EF-7C39817132A0}.Release.Build.0 = Release|Win32\r
EndGlobalSection\r
GlobalSection(ExtensibilityGlobals) = postSolution\r
EndGlobalSection\r
<Filter\r
Name="Source Files"\r
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">\r
- <File\r
- RelativePath="yasm-module.c">\r
- <FileConfiguration\r
- Name="Debug|Win32">\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- Optimization="0"\r
- AdditionalIncludeDirectories="../../frontends/yasm"\r
- PreprocessorDefinitions=""\r
- BasicRuntimeChecks="3"/>\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Release|Win32">\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- Optimization="2"\r
- AdditionalIncludeDirectories="../../frontends/yasm"\r
- PreprocessorDefinitions=""/>\r
- </FileConfiguration>\r
- </File>\r
- <File\r
- RelativePath="..\..\frontends\yasm\yasm-module.h">\r
- </File>\r
<File\r
RelativePath="..\..\frontends\yasm\yasm-options.c">\r
<FileConfiguration\r
#define OUTPUT "module.c"
#define MAXLINE 1024
+#define MAXMODULES 128
int
main(int argc, char *argv[])
int i;
int len;
char *strp;
+ char *modules[MAXMODULES];
+ int num_modules = 0;
if (argc < 2) {
fprintf(stderr, "Usage: %s <file> [module_name ...]\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]);
+ }
+#endif
+
out = fopen(OUTPUT, "wt");
if (!out) {
return EXIT_FAILURE;
}
- str = malloc(MAXLINE);
-
fprintf(out, "/* This file auto-generated by genmodule.c"
" - don't edit it */\n\n");
}
*strp = '\0';
- for (i=2; i<argc; i++) {
- if (strncmp(argv[i], str+8, len) == 0) {
+ for (i=0; i<num_modules; i++) {
+ if (strncmp(modules[i], str+8, len) == 0) {
fprintf(out, " {\"%s\", &yasm_%s_LTX_%s},\n",
- argv[i]+len+1, argv[i]+len+1, str+8);
+ modules[i]+len+1, modules[i]+len+1, str+8);
}
}
} else if (strncmp(str, "EXTERN_LIST", 11) == 0) {
- for (i=2; i<argc; i++) {
- strcpy(str, argv[i]);
+ for (i=0; i<num_modules; i++) {
+ strcpy(str, modules[i]);
strp = str;
while (*strp != '\0' && *strp != '_') {
len++;
fclose(in);
fclose(out);
+ for (i=0; i<num_modules; i++)
+ free(modules[i]);
free(str);
return EXIT_SUCCESS;