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)
18 #*******************************************************************************
21 #*******************************************************************************
24 # search path for source files. make finds them automatically.
33 -I${SRC_DIR}/elftosb2 \
38 #*******************************************************************************
41 # -g : Produce debugging information.
43 CFLAGS = -g $(INC_PATH) -D${UNAMES}
45 #*******************************************************************************
78 ExcludesListMatcher.o \
83 OBJ_FILES_ELFTOSB2 = \
85 BootImageGenerator.o \
86 ConversionController.o \
91 elftosb_parser.tab.o \
92 EncoreBootImageGenerator.o
96 EncoreBootImageReader.o \
100 ${OBJ_FILES_COMMON} \
107 ifeq ("${UNAMES}", "Linux")
108 EXEC_FILE_ELFTOSB2 = elftosb
109 EXEC_FILE_SBTOOL = sbtool
110 EXEC_FILE_KEYGEN = keygen
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")
120 #*******************************************************************************
123 all: elftosb sbtool keygen
125 # Uncomment the next line to print out the environment variables.
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}"
136 rm -f ${OBJ_FILES_ELFTOSB2} ${OBJ_FILES_SBTOOL} ${OBJ_FILES_KEYGEN} \
137 ${EXEC_FILE_ELFTOSB2} ${EXEC_FILE_SBTOOL} ${EXEC_FILE_KEYGEN}
139 elftosb: ${OBJ_FILES_ELFTOSB2}
140 gcc ${OBJ_FILES_ELFTOSB2} ${LIBS} -o ${EXEC_FILE_ELFTOSB2}
142 sbtool: ${OBJ_FILES_SBTOOL}
143 gcc ${OBJ_FILES_SBTOOL} ${LIBS} -o ${EXEC_FILE_SBTOOL}
145 keygen: ${OBJ_FILES_KEYGEN}
146 gcc ${OBJ_FILES_KEYGEN} ${LIBS} -o ${EXEC_FILE_KEYGEN}
149 #ifeq ("${UNAMES}", "Linux")
150 # Use default rules for creating all the .o files from the .c files. Only
152 .SUFFIXES : .c .cpp .o .h
162 #*******************************************************************************
163 # Automatic dependency generation
167 $(CC) -MM $(CFLAGS) $< | \
168 sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
169 [ -s $@ ] || rm -f $@
173 $(CC) -MM $(CFLAGS) $< | \
174 sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
175 [ -s $@ ] || rm -f $@
177 #*******************************************************************************