我的makfile 的程式如下:
CFLAGS = $(CROSS_CFLAGS)
STRIP_CMD = $(STRIP) -R .note -R .comment
all: hello.gdb hello
hello.o: hello.c
@echo ""
@echo "[ -- Start to compile hello.c to hello.o -- ]"
$(CC) $(CFLAGS) -c $^
hello.gdb: hello.o
@echo ""
@echo "[ -- Start to link hello.o to hello.gdb -- ]"
$(CC) $(LDFLAGS) $(LINK_S) $^ $(LINK_E) -o $@
hello:
@echo ""
@echo ""
@echo "[ -- Start to strip hello.gdb and produce hello -- ]"
$(STRIP_CMD) hello.gdb -o $@
clean:
rm -rf hello hello.o hello.gdb
include ../cross.mk
cross.mk的程式如下:
##[Tool Chain TOP directory]##########################
TOOL_TOP = /opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-9tdmi-linux-gnu
##[GCC and GLIBC LIBRARY path]########################
GCC_LIB_PATH = $(TOOL_TOP)/lib/gcc/arm-9tdmi-linux-gnu/3.4.1
GLIBC_PATH = $(TOOL_TOP)/arm-9tdmi-linux-gnu
##[GCC COMPILER path and flags]#######################
CC = $(TOOL_TOP)/bin/arm-9tdmi-linux-gnu-gcc
AR = $(TOOL_TOP)/bin/arm-9tdmi-linux-gnu-ar
LD = $(TOOL_TOP)/bin/arm-9tdmi-linux-gnu-ld
AS = $(TOOL_TOP)/bin/arm-9tdmi-linux-gnu-as
STRIP = $(TOOL_TOP)/bin/arm-9tdmi-linux-gnu-strip
RANLIB = $(TOOL_TOP)/bin/arm-9tdmi-linux-gnu-ranlib
INSTALL = /usr/bin/install
TARGET_ARCH = arm-linux
CROSS_CFLAGS = -nostdinc -I$(GLIBC_PATH)/include -I$(GCC_LIB_PATH)/include
##[GCC LINKER path and flags]#########################
LD = $(TOOL_TOP)/arm-9tdmi-linux-gnu/bin/ld
LDFLAGS += -Wl,-nostdlib -Wl,-L,$(GLIBC_PATH)/lib -Wl,-L,$(GCC_LIB_PATH) -Wl,-rpath,$(GLIBC_PATH)/lib -Wl,-rpath,/lib -Wl,-rpath-link,$(GLIBC_PATH)/lib -nostartfiles -nodefaultlibs
##[Libraries to be linked]############################
LIBS = -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
LINK_S = $(GLIBC_PATH)/lib/crt1.o $(GLIBC_PATH)/lib/crti.o $(GCC_LIB_PATH)/crtbegin.o
LINK_E = $(GCC_LIB_PATH)/crtend.o $(GLIBC_PATH)/lib/crtn.o $(LIBS)
現在是Linux底下編寫ARM的C指令並且compile,會產生一個執行檔通過tftp可以在arm裡面直接使用,請問如果我要在裡面加入一個副檔名為.s,並且也可以通過tftp傳送到arm直接使用,那個makedile要如何撰寫?