]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Tools/Source/UefiVfrCompile/VfrCompiler.h
a980cb5b1a0c48ae2abcec9f43ee4503ca965d31
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / UefiVfrCompile / VfrCompiler.h
1 #ifndef _VFRCOMPILER_H_
2 #define _VFRCOMPILER_H_
3
4 #include "Tiano.h"
5 #include "EfiTypes.h"
6 #include "EfiVfr.h"
7 #include "VfrFormPkg.h"
8 #include "VfrUtilityLib.h"
9
10 #define PROGRAM_NAME "VfrCompile"
11 #define VFR_COMPILER_VERSION "UEFI 2.1"
12
13 //
14 // This is how we invoke the C preprocessor on the VFR source file
15 // to resolve #defines, #includes, etc. To make C source files
16 // shareable between VFR and drivers, define VFRCOMPILE so that
17 // #ifdefs can be used in shared .h files.
18 //
19 #define PREPROCESSOR_COMMAND "cl "
20 #define PREPROCESSOR_OPTIONS "/nologo /E /TC /DVFRCOMPILE "
21
22 //
23 // Specify the filename extensions for the files we generate.
24 //
25 #define VFR_PREPROCESS_FILENAME_EXTENSION ".i"
26 #define VFR_PACKAGE_FILENAME_EXTENSION ".hpk"
27 #define VFR_RECORDLIST_FILENAME_EXTENSION ".lst"
28
29 typedef struct {
30 INT8 VfrFileName[MAX_PATH];
31 INT8 RecordListFile[MAX_PATH];
32 INT8 PkgOutputFileName[MAX_PATH];
33 INT8 COutputFileName[MAX_PATH];
34 bool CreateRecordListFile;
35 bool CreateIfrPkgFile;
36 INT8 OutputDirectory[MAX_PATH];
37 INT8 PreprocessorOutputFileName[MAX_PATH];
38 INT8 VfrBaseFileName[MAX_PATH]; // name of input VFR file with no path or extension
39 INT8 *IncludePaths;
40 INT8 *CPreprocessorOptions;
41 } OPTIONS;
42
43 typedef enum {
44 STATUS_INITIALIZED = 1,
45 STATUS_PREPROCESSED,
46 STATUS_COMPILEED,
47 STATUS_GENBINARY,
48 STATUS_FINISHED,
49 STATUS_FAILED,
50 STATUS_DEAD,
51 } COMPILER_RUN_STATUS;
52
53 class CVfrCompiler {
54 private:
55 COMPILER_RUN_STATUS mRunStatus;
56 OPTIONS mOptions;
57 INT8 *mPreProcessCmd;
58 INT8 *mPreProcessOpt;
59
60 VOID OptionInitialization (IN INT32 , IN INT8 **);
61 VOID AppendIncludePath (IN INT8 *);
62 VOID AppendCPreprocessorOptions (IN INT8 *);
63 INT8 SetBaseFileName (VOID);
64 INT8 SetPkgOutputFileName (VOID);
65 INT8 SetCOutputFileName(VOID);
66 INT8 SetPreprocessorOutputFileName (VOID);
67 INT8 SetRecordListFileName (VOID);
68
69 VOID SET_RUN_STATUS (IN COMPILER_RUN_STATUS);
70 BOOLEAN IS_RUN_STATUS (IN COMPILER_RUN_STATUS);
71
72 public:
73 COMPILER_RUN_STATUS RunStatus (VOID) {
74 return mRunStatus;
75 }
76
77 public:
78 CVfrCompiler (IN INT32 , IN INT8 **);
79 ~CVfrCompiler ();
80
81 VOID Usage (VOID);
82
83 VOID PreProcess (VOID);
84 VOID Compile (VOID);
85 VOID GenBinary (VOID);
86 VOID GenCFile (VOID);
87 VOID GenRecordListFile (VOID);
88 };
89
90 #endif