1 #*******************************************************************************
4 # gnu make makefile rules for elftosb executable. make needs to be called
5 # with the following command:
7 # make -C ${BUILD_DIR} -f ${SRC_DIR}/makefile.rules SRC_DIR=${SRC_DIR} $@;
9 # SRC_DIR needs to be passed in. It is assumed that make is running in
10 # the build directory.
12 #*******************************************************************************
15 # UNAMES is going to be set to either "Linux" or "CYGWIN_NT-5.1"
16 UNAMES = $(shell uname -s)
20 #*******************************************************************************
23 #*******************************************************************************
26 # search path for source files. make finds them automatically.
35 -I${SRC_DIR}/elftosb2 \
40 #*******************************************************************************
43 # -g : Produce debugging information.
45 CXXFLAGS = -g $(INC_PATH) -D${UNAMES}
47 #*******************************************************************************
80 ExcludesListMatcher.o \
85 OBJ_FILES_ELFTOSB2 = \
87 BootImageGenerator.o \
88 ConversionController.o \
93 elftosb_parser.tab.o \
94 EncoreBootImageGenerator.o
98 EncoreBootImageReader.o \
102 ${OBJ_FILES_COMMON} \
109 ifeq ("${UNAMES}", "Linux")
110 EXEC_FILE_ELFTOSB2 = elftosb
111 EXEC_FILE_SBTOOL = sbtool
112 EXEC_FILE_KEYGEN = keygen
114 ifeq ("${UNAMES}", "CYGWIN_NT-5.1")
115 EXEC_FILE_ELFTOSB2 = elftosb.exe
116 EXEC_FILE_SBTOOL = sbtool.exe
117 EXEC_FILE_KEYGEN = keygen.exe
118 endif # ifeq ("${UNAMES}", "CYGWIN_NT-5.1")
119 endif # ifeq ("${UNAMES}", "Linux")
122 #*******************************************************************************
125 all: elftosb sbtool keygen
127 # Uncomment the next line to print out the environment variables.
131 @echo "SRC_DIR = ${SRC_DIR}"
132 @echo "OBJ_FILES = ${OBJ_FILES_ELFTOSB2}"
133 @echo "LIBS = ${LIBS}"
134 @echo "EXEC_FILE_ELFTOSB2 = ${EXEC_FILE_ELFTOSB2}"
135 @echo "BUILD_DIR = ${BUILD_DIR}"
138 rm -f ${OBJ_FILES_ELFTOSB2} ${OBJ_FILES_SBTOOL} ${OBJ_FILES_KEYGEN} \
139 ${EXEC_FILE_ELFTOSB2} ${EXEC_FILE_SBTOOL} ${EXEC_FILE_KEYGEN}
141 elftosb: ${OBJ_FILES_ELFTOSB2}
142 $(CXX) ${OBJ_FILES_ELFTOSB2} ${LIBS} -o ${EXEC_FILE_ELFTOSB2}
144 sbtool: ${OBJ_FILES_SBTOOL}
145 $(CXX) ${OBJ_FILES_SBTOOL} ${LIBS} -o ${EXEC_FILE_SBTOOL}
147 keygen: ${OBJ_FILES_KEYGEN}
148 $(CXX) ${OBJ_FILES_KEYGEN} ${LIBS} -o ${EXEC_FILE_KEYGEN}
151 #ifeq ("${UNAMES}", "Linux")
152 # Use default rules for creating all the .o files from the .c files. Only
154 .SUFFIXES : .c .cpp .o .h
157 $(CC) ${CXXFLAGS} -c $<
160 $(CXX) ${CXXFLAGS} -c $<
164 #*******************************************************************************
165 # Automatic dependency generation
169 $(CC) -MM $(CXXFLAGS) $< | \
170 sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
171 [ -s $@ ] || rm -f $@
175 $(CC) -MM $(CXXFLAGS) $< | \
176 sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
177 [ -s $@ ] || rm -f $@
179 #*******************************************************************************