为 PALM 写的 Makefile 时间: 04/05/1
一切只是开始 · 2004-06-24(近似)
为 PALM 写的 Makefile
时间: 04/05/10
使用
prc-tool
开发
Palm
程序,
makefile
是必不可少的,其实和通用的
Makefile
没有什么大的区别
如果不写
Makefile,
需要依次输入以下命令:
1.
Compile the .c file to .o file
m68k-palmos-gcc –O1 –c main.c –o main.o
m68k-palmos-gcc –O1 –c other.c –o other.o
2.
Link into an executable file
m68k-palmos-gcc –O1 main.o other.o –o GNUSample.tmp
3.
Split the object into application sections, produce
a
.grc file
m68k-palmos-obj-res GNUSample.tmp
4.
Compile the resource (Use the pilrc to convert the static element to resource)
pilrc GNUSample.rcp
5.
Build the application
Build-prc GUNSample.prc “GNU Sample” Eric *.bin *.GNUSample.grc
最容易看懂的,低级的
Makefile
就是老老实实把要编译的命令敲进去,只当是一个批处理文件用。我还挺喜欢这样的,不过如果以后程序扩展,修改的话,需要修改多处地方,可维护性差一点
all : helloworld.prc clean
helloworld.prc : code0000.helloworld.grc tver0001.bin
build-prc helloworld.prc "Hello world" HeWo *.helloworld.grc *.bin
ls -l helloworld.prc
tver0001.bin : helloworld.rcp ../resources/icon.bmp ../resources/icon_s.bmp
pilrc helloworld.rcp
code0000.helloworld.grc : helloworld.c
m68k-palmos-gcc -O2 helloworld.c -o helloworld
m68k-palmos-obj-res helloworld
clean :
rm helloworld *.helloworld.grc *.bin
from:
http://www.ligfiets.net/toni/palm/tutorial/uk/
复杂点的,初学者不太容易看得懂的,但是维护性比较高的
Makefile
APP
= table
ICONTEXT
= "Table Example"
APPID
= LFtb
RCP
= $(APP).rcp
PRC
= $(APP).prc
SRC
= $(APP).c
GRC
= $(APP).grc
BIN
= $(APP).bin
CC
= m68k-palmos-gcc
PILRC
= pilrc
OBJRES
= m68k-palmos-obj-res
BUILDPRC
= build-prc
# uncomment this if you want to build a gdb debuggable version
# -On: n=Optimization-level (0=none), -g: needed for debugging
# CFLAGS = -O0 -g $(DEFINES) $(INCLUDES)
CFLAGS = -O2 $(DEFINES) $(INCLUDES)
all: $(PRC)
$(PRC): grc.stamp bin.stamp;
$(BUILDPRC) $(PRC) $(ICONTEXT) $(APPID) *.grc *.bin $(LINKFILES)
ls -l *.prc
grc.stamp: $(APP) ;
$(OBJRES) $(APP)
touch $@
$(APP): $(SRC:.c=.o) ;
$(CC) $(CFLAGS) $^ -o $@
bin.stamp: $(RCP) ;
$(PILRC) $^ $(BINDIR)
touch $@
%.o: %.c ;
$(CC) $(CFLAGS) -c $< -o $@
#
touch $<
# enable this line if you want to compile EVERY time.
depend dep: ;
$(CC) -M $(SRC) > .dependencies
clean:
rm -rf *.o $(APP) *.bin *.grc *.stamp
veryclean: clean
rm -rf *.prc *.bak *~
from:
http://www.palmosbible.com
carol
发表于
04/05/10 16:28
引用(Trackback0)
评论
发表评论
用户名:
Email:
主页:
最后更新
[转贴]真的了解telnet吗?
[图]Introduction to Bluetooth
Record - June 15th~
[WIN CE] 远程控制,事半功倍
从开发角度看 smartphone
palm 上五種不同的 reset [转]
法语
The 11 Truths of Debugging
[转贴]微软Smartphone应用程序设计入门
smartphone 一览
原始快照:web.archive.org