]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Tools/Source/UefiVfrCompile/VfrCompiler.h
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Sample / Tools / Source / UefiVfrCompile / VfrCompiler.h
1 /*++
2
3 Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 VfrCompiler.h
15
16 Abstract:
17
18 --*/
19
20 #ifndef _VFRCOMPILER_H_
21 #define _VFRCOMPILER_H_
22
23 #include "Tiano.h"
24 #include "EfiTypes.h"
25 #include "EfiVfr.h"
26 #include "VfrFormPkg.h"
27 #include "VfrUtilityLib.h"
28
29 #define UTILITY_NAME "VfrCompile"
30 #define UTILITY_VERSION "v1.1"
31
32 //
33 // This is how we invoke the C preprocessor on the VFR source file
34 // to resolve #defines, #includes, etc. To make C source files
35 // shareable between VFR and drivers, define VFRCOMPILE so that
36 // #ifdefs can be used in shared .h files.
37 //
38 #define PREPROCESSOR_COMMAND "cl "
39 #define PREPROCESSOR_OPTIONS "/nologo /E /TC /DVFRCOMPILE "
40
41 //
42 // Specify the filename extensions for the files we generate.
43 //
44 #define VFR_PREPROCESS_FILENAME_EXTENSION ".i"
45 #define VFR_PACKAGE_FILENAME_EXTENSION ".hpk"
46 #define VFR_RECORDLIST_FILENAME_EXTENSION ".lst"
47
48 typedef struct {
49 INT8 VfrFileName[MAX_PATH];
50 INT8 RecordListFile[MAX_PATH];
51 INT8 PkgOutputFileName[MAX_PATH];
52 INT8 COutputFileName[MAX_PATH];
53 bool CreateRecordListFile;
54 bool CreateIfrPkgFile;
55 INT8 OutputDirectory[MAX_PATH];
56 INT8 PreprocessorOutputFileName[MAX_PATH];
57 INT8 VfrBaseFileName[MAX_PATH]; // name of input VFR file with no path or extension
58 INT8 *IncludePaths;
59 bool SkipCPreprocessor;
60 INT8 *CPreprocessorOptions;
61 } OPTIONS;
62
63 typedef enum {
64 STATUS_INITIALIZED = 1,
65 STATUS_PREPROCESSED,
66 STATUS_COMPILEED,
67 STATUS_GENBINARY,
68 STATUS_FINISHED,
69 STATUS_FAILED,
70 STATUS_DEAD,
71 } COMPILER_RUN_STATUS;
72
73 class CVfrCompiler {
74 private:
75 COMPILER_RUN_STATUS mRunStatus;
76 OPTIONS mOptions;
77 INT8 *mPreProcessCmd;
78 INT8 *mPreProcessOpt;
79
80 VOID OptionInitialization (IN INT32 , IN INT8 **);
81 VOID AppendIncludePath (IN INT8 *);
82 VOID AppendCPreprocessorOptions (IN INT8 *);
83 INT8 SetBaseFileName (VOID);
84 INT8 SetPkgOutputFileName (VOID);
85 INT8 SetCOutputFileName(VOID);
86 INT8 SetPreprocessorOutputFileName (VOID);
87 INT8 SetRecordListFileName (VOID);
88
89 VOID SET_RUN_STATUS (IN COMPILER_RUN_STATUS);
90 BOOLEAN IS_RUN_STATUS (IN COMPILER_RUN_STATUS);
91
92 public:
93 COMPILER_RUN_STATUS RunStatus (VOID) {
94 return mRunStatus;
95 }
96
97 public:
98 CVfrCompiler (IN INT32 , IN INT8 **);
99 ~CVfrCompiler ();
100
101 VOID Usage (VOID);
102
103 VOID PreProcess (VOID);
104 VOID Compile (VOID);
105 VOID GenBinary (VOID);
106 VOID GenCFile (VOID);
107 VOID GenRecordListFile (VOID);
108 };
109
110 #endif