tools: elftosb: makefile indentation and whitespace cleanup
[karo-tx-uboot.git] / tools / elftosb / makefile.rules
1 #*******************************************************************************
2 #                               makefile.rules
3 # Description:
4 #   gnu make makefile rules for elftosb executable.  make needs to be called
5 #   with the following command:
6 #
7 #   make -C ${BUILD_DIR} -f ${SRC_DIR}/makefile.rules SRC_DIR=${SRC_DIR} $@;
8 #
9 #   SRC_DIR needs to be passed in.  It is assumed that make is running in
10 #   the build directory.
11
12 #*******************************************************************************
13 #                               Environment
14
15 # UNAMES is going to be set to either "Linux" or "CYGWIN_NT-5.1"
16 UNAMES = $(shell uname -s)
17
18 #*******************************************************************************
19 #                               Directories
20
21 #*******************************************************************************
22 #                               Paths
23
24 # search path for source files. make finds them automatically.
25 VPATH =                                         \
26         ${SRC_DIR}/common                       \
27         ${SRC_DIR}/elftosb2                     \
28         ${SRC_DIR}/sbtool                       \
29         ${SRC_DIR}/keygen
30
31 # include directories
32 INC_PATH =                                      \
33     -I${SRC_DIR}/elftosb2                       \
34     -I${SRC_DIR}/keygen                         \
35     -I${SRC_DIR}/sbtool                         \
36     -I${SRC_DIR}/common
37
38 #*******************************************************************************
39 #                               Build flags
40 # gcc Compiler flags
41 #    -g                                         : Produce debugging information.
42
43 CFLAGS      = -g $(INC_PATH) -D${UNAMES}
44
45 #*******************************************************************************
46 #                               File lists
47
48 OBJ_FILES_COMMON =                              \
49         AESKey.o                                \
50         Blob.o                                  \
51         crc.o                                   \
52         DataSource.o                            \
53         DataTarget.o                            \
54         ELFSourceFile.o                         \
55         EncoreBootImage.o                       \
56         EvalContext.o                           \
57         GHSSecInfo.o                            \
58         GlobMatcher.o                           \
59         HexValues.o                             \
60         Logging.o                               \
61         Operation.o                             \
62         OptionDictionary.o                      \
63         options.o                               \
64         OutputSection.o                         \
65         Random.o                                \
66         RijndaelCBCMAC.o                        \
67         rijndael.o                              \
68         SHA1.o                                  \
69         SourceFile.o                            \
70         SRecordSourceFile.o                     \
71         stdafx.o                                \
72         StELFFile.o                             \
73         StExecutableImage.o                     \
74         StSRecordFile.o                         \
75         Value.o                                 \
76         Version.o                               \
77         format_string.o                         \
78         ExcludesListMatcher.o                   \
79         SearchPath.o                            \
80         DataSourceImager.o                      \
81         IVTDataSource.o
82
83 OBJ_FILES_ELFTOSB2 =                            \
84         ${OBJ_FILES_COMMON}                     \
85         BootImageGenerator.o                    \
86         ConversionController.o                  \
87         ElftosbAST.o                            \
88         elftosb.o                               \
89         elftosb_lexer.o                         \
90         ElftosbLexer.o                          \
91         elftosb_parser.tab.o                    \
92         EncoreBootImageGenerator.o
93
94 OBJ_FILES_SBTOOL =                              \
95         ${OBJ_FILES_COMMON}                     \
96         EncoreBootImageReader.o                 \
97         sbtool.o
98
99 OBJ_FILES_KEYGEN =                              \
100         ${OBJ_FILES_COMMON}                     \
101         keygen.o
102
103
104 LIBS = -lstdc++
105
106
107 ifeq ("${UNAMES}", "Linux")
108 EXEC_FILE_ELFTOSB2 = elftosb
109 EXEC_FILE_SBTOOL = sbtool
110 EXEC_FILE_KEYGEN = keygen
111 else
112 ifeq ("${UNAMES}", "CYGWIN_NT-5.1")
113 EXEC_FILE_ELFTOSB2 = elftosb.exe
114 EXEC_FILE_SBTOOL = sbtool.exe
115 EXEC_FILE_KEYGEN = keygen.exe
116 endif # ifeq ("${UNAMES}", "CYGWIN_NT-5.1")
117 endif # ifeq ("${UNAMES}", "Linux")
118
119
120 #*******************************************************************************
121 #                                 Targets
122
123 all: elftosb sbtool keygen
124
125 # Uncomment the next line to print out the environment variables.
126 all: exec_always
127
128 exec_always:
129         @echo "SRC_DIR = ${SRC_DIR}"
130         @echo "OBJ_FILES = ${OBJ_FILES_ELFTOSB2}"
131         @echo "LIBS = ${LIBS}"
132         @echo "EXEC_FILE_ELFTOSB2 = ${EXEC_FILE_ELFTOSB2}"
133         @echo "BUILD_DIR = ${BUILD_DIR}"
134
135 clean:
136         rm -f ${OBJ_FILES_ELFTOSB2} ${OBJ_FILES_SBTOOL} ${OBJ_FILES_KEYGEN} \
137                 ${EXEC_FILE_ELFTOSB2} ${EXEC_FILE_SBTOOL} ${EXEC_FILE_KEYGEN}
138
139 elftosb: ${OBJ_FILES_ELFTOSB2}
140         gcc ${OBJ_FILES_ELFTOSB2} ${LIBS} -o ${EXEC_FILE_ELFTOSB2}
141
142 sbtool: ${OBJ_FILES_SBTOOL}
143         gcc ${OBJ_FILES_SBTOOL} ${LIBS} -o ${EXEC_FILE_SBTOOL}
144
145 keygen: ${OBJ_FILES_KEYGEN}
146         gcc ${OBJ_FILES_KEYGEN} ${LIBS} -o ${EXEC_FILE_KEYGEN}
147
148
149 #ifeq ("${UNAMES}", "Linux")
150 # Use default rules for creating all the .o files from the .c files.  Only
151 # for linux
152 .SUFFIXES : .c .cpp .o .h
153
154 .c.o:
155         gcc ${CFLAGS} -c $<
156
157 .cpp.o:
158         gcc ${CFLAGS} -c $<
159
160 #endif
161
162 #*******************************************************************************
163 #                       Automatic dependency generation
164
165 %.d: %.c
166         @set -e; \
167         $(CC) -MM $(CFLAGS) $< | \
168         sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
169         [ -s $@ ]  || rm -f $@
170
171 %.d: %.cpp
172         @set -e; \
173         $(CC) -MM $(CFLAGS) $< | \
174         sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
175         [ -s $@ ]  || rm -f $@
176
177 #*******************************************************************************