2008-06-13 01:22:49 +03:00
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
# published by the Free Software Foundation; either version 2 of
|
|
|
|
# the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
# MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2008-07-25 05:27:23 +03:00
|
|
|
include config.mk
|
2008-06-13 01:22:49 +03:00
|
|
|
|
2008-08-13 02:37:17 +03:00
|
|
|
BUILD_DATE := $(shell date)
|
|
|
|
BUILD_HOST := $(shell hostname)
|
|
|
|
BUILD_BRANCH := $(shell git branch | grep ^\* | cut -d' ' -f2)
|
|
|
|
BUILD_HEAD := $(shell git show --pretty=oneline | head -n1 | cut -d' ' -f1 | cut -b1-16)
|
|
|
|
BUILD_VERSION := ${BUILD_BRANCH}_${BUILD_HEAD}
|
|
|
|
|
2008-11-28 12:16:40 +02:00
|
|
|
LDS = src/cpu/$(CPU)/qi.lds
|
2008-07-25 05:27:23 +03:00
|
|
|
INCLUDE = include
|
|
|
|
IMAGE_DIR = image
|
2008-11-28 12:16:37 +02:00
|
|
|
TOOLS = tools
|
2008-11-28 12:16:36 +02:00
|
|
|
CFLAGS = -Wall -Werror -I $(INCLUDE) -g -c -Os -fno-strict-aliasing -mlong-calls \
|
2008-08-13 02:44:29 +03:00
|
|
|
-fno-common -ffixed-r8 -msoft-float -fno-builtin -ffreestanding \
|
|
|
|
-march=armv4t -mno-thumb-interwork -Wstrict-prototypes \
|
2008-08-13 02:43:27 +03:00
|
|
|
-DBUILD_HOST="${BUILD_HOST}" -DBUILD_VERSION="${BUILD_VERSION}" \
|
2008-11-28 12:16:40 +02:00
|
|
|
-DBUILD_DATE="${BUILD_DATE}" -DQI_CPU="${CPU}"
|
2008-07-25 05:27:23 +03:00
|
|
|
LDFLAGS =
|
2008-11-28 12:16:37 +02:00
|
|
|
|
2008-11-28 12:16:40 +02:00
|
|
|
S_SRCS = $(wildcard src/cpu/$(CPU)/*.S)
|
2008-07-25 05:27:23 +03:00
|
|
|
S_OBJS = $(patsubst %.S,%.o, $(S_SRCS))
|
2008-11-28 12:16:40 +02:00
|
|
|
C_SRCS = $(wildcard src/*.c) \
|
|
|
|
$(wildcard src/drivers/*.c) $(wildcard src/fs/*.c) \
|
|
|
|
$(wildcard src/cpu/$(CPU)/*.c)
|
2008-07-25 05:27:23 +03:00
|
|
|
C_OBJS = $(patsubst %.c,%.o, $(C_SRCS))
|
|
|
|
|
|
|
|
SRCS = ${S_SRCS} ${C_SRCS}
|
|
|
|
OBJS = ${S_OBJS} ${C_OBJS}
|
2008-08-13 02:35:09 +03:00
|
|
|
LIBS = -L${COMPILER_LIB_PATH} -lgcc
|
2008-07-25 05:27:23 +03:00
|
|
|
|
2008-11-28 12:16:40 +02:00
|
|
|
OBJS = src/cpu/s3c6410/start.o src/cpu/s3c6410/start_qi.o src/cpu/s3c6410/serial-s3c64xx.o src/ctype.o src/utils.o src/cpu/s3c6410/tla01.o src/phase2.o
|
|
|
|
|
2008-08-13 02:34:06 +03:00
|
|
|
# GTA02 A5 and A6 U-Boot will eat these for DFU action
|
|
|
|
UDFU_VID = 0x1d50
|
|
|
|
UDFU_PID = 0x5119
|
|
|
|
UDFU_REV = 0x350
|
|
|
|
|
2008-11-28 12:16:40 +02:00
|
|
|
TARGET = image/start_qi_all-$(CPU)
|
|
|
|
IMAGE = $(IMAGE_DIR)/qi-$(CPU)-$(BUILD_VERSION)
|
|
|
|
UDFU_IMAGE = $(IMAGE_DIR)/qi-$(CPU)-$(BUILD_VERSION).udfu
|
2008-07-25 05:27:23 +03:00
|
|
|
|
2008-11-28 12:16:37 +02:00
|
|
|
MKUDFU = $(TOOLS)/mkudfu
|
|
|
|
|
2008-07-25 05:27:23 +03:00
|
|
|
%.o: %.S
|
|
|
|
@$(CC) $(CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
@$(CC) $(CFLAGS) -o $@ $<
|
2008-06-13 01:22:49 +03:00
|
|
|
|
2008-08-13 02:34:06 +03:00
|
|
|
all:${UDFU_IMAGE}
|
2008-06-13 01:22:49 +03:00
|
|
|
|
2008-11-28 12:16:37 +02:00
|
|
|
${OBJS}:${SRCS} ${INCLUDE}/*.h
|
|
|
|
|
|
|
|
${MKUDFU}:
|
|
|
|
make -C $(TOOLS)
|
2008-07-25 05:27:23 +03:00
|
|
|
|
2008-11-28 12:16:37 +02:00
|
|
|
${UDFU_IMAGE}:${OBJS} ${MKUDFU}
|
2008-11-28 12:16:40 +02:00
|
|
|
mkdir -p image
|
2008-11-28 12:16:36 +02:00
|
|
|
@$(LD) ${LDFLAGS} -T$(LDS) -g $(OBJS) -o ${TARGET} ${LIBS}
|
|
|
|
@$(OBJCOPY) -O binary -S ${TARGET} ${IMAGE}
|
|
|
|
@$(MKUDFU) -v ${UDFU_VID} -p ${UDFU_PID} -r ${UDFU_REV} \
|
2008-08-13 02:34:06 +03:00
|
|
|
-d ${IMAGE} ${UDFU_IMAGE}
|
2008-11-28 12:16:36 +02:00
|
|
|
@$(OBJDUMP) -d ${TARGET} >${IMAGE}.dis
|
2008-07-25 05:27:23 +03:00
|
|
|
|
|
|
|
clean:
|
2008-11-28 12:16:40 +02:00
|
|
|
@rm -f src/*.o cpu/*/*.o cpu/*/*~ src/*~ src/drivers/*.o src/drivers/*~ include/*~ ${IMAGE_DIR}/* ${TARGET} ${UDFU_IMAGE}
|
2008-11-28 12:16:39 +02:00
|
|
|
@make clean -C $(TOOLS)
|