1 #######################################################################
2 ### App specific part - this must be defined
3 #NAME="AnimatedStereogram"
7 #EPOCLIBS="euser.lib apparc.lib cone.lib eikcore.lib eikcoctl.lib qikcore.lib fbscli.lib estlib.lib"
8 #EPOCROOT=/opt/space/uiq3/
9 #######################################################################
11 APPNAME ?= "UIQ3 Program"
18 HEAP ?= 0x1000,0x100000
19 EPOCROOT ?= /opt/space/uiq3/
20 GCCPREF ?= arm-none-symbianelf
21 GCCPATH ?= $(EPOCROOT)/gcc
26 NAME_ := $(shell echo $(APPNAME) | sed 's: ::g')
27 NAME := $(shell perl -e "print lc(\"$(NAME_)\")")
28 EPOCLIBS += euser.lib apparc.lib cone.lib eikcore.lib eikcoctl.lib qikcore.lib fbscli.lib estlib.lib qikallocdll.lib
29 EPOCREL = $(EPOCROOT)/epoc32/release/armv5
36 EPOCRC = EPOCROOT=$(EPOCROOT) epocrc
38 PATH := $(EPOCROOT)/bin:$(GCCPATH)/bin:$(GCCPATH)/$(GCCPREF)/bin:$(PATH)
40 # TODO: do we really need -mapcs?
42 CFLAGS += -Wall -pipe -nostdinc -msoft-float
43 CFLAGS += -DNDEBUG -D_UNICODE -D__GCCE__ -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__
44 CFLAGS += -D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ -D__MARM_ARMV5__
45 CFLAGS += -D__PRODUCT_INCLUDE__="$(EPOCROOT)/epoc32/include/variant/uiq_3.0.hrh"
46 CFLAGS += -include $(EPOCROOT)/epoc32/include/gcce/gcce.h
47 CFLAGS += -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/libc \
48 -I$(EPOCROOT)/epoc32/include/variant -I$(GCCPATH)/lib/gcc/arm-none-symbianelf/$(GCCVER)/include/
49 # can't optimize .cpp without -fno-unit-at-a-time
50 CXXFLAGS += $(CFLAGS) -c -x c++ -mapcs -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -fexceptions -fno-unit-at-a-time
52 LDFLAGS += -L$(GCCPATH)/lib -L$(GCCPATH)/lib/gcc/$(GCCPREF)/$(GCCVER) -L $(GCCPATH)/$(GCCPREF)/lib
53 LDFLAGS += --target1-abs --no-undefined -nostdlib -shared
54 LDFLAGS += -Ttext 0x8000 -Tdata 0x400000 --default-symver
55 LDFLAGS += -soname $(NAME){000a0000}\[$(UID3)\].exe --entry _E32Startup -u _E32Startup
56 LDFLAGS += $(EPOCROOT)/epoc32/release/armv5/urel/eexe.lib
57 LDFLAGS += -o $(NAME).elf.exe -Map $(NAME).exe.map
58 LDFLAGS2 = $(EPOCREL)/urel/qikalloc.lib $(EPOCREL)/lib/euser.dso
59 LDFLAGS2 += $(shell for i in $(EPOCLIBS); do echo -n " $(EPOCREL)/lib/$${i%%.lib}.dso "; done)
60 LDFLAGS2 += $(EPOCREL)/urel/usrt2_2.lib
61 LDFLAGS2 += $(shell for i in dfpaeabi dfprvct2_2 drtaeabi scppnwdl drtrvct2_2; do echo -n " $(EPOCREL)/lib/$$i.dso "; done)
62 LDFLAGS2 += -lsupc++ -lgcc
64 E32FLAGS += --sid=0x$(UID3) --uid1=0x1000007a --uid2=0x$(UID2) --uid3=0x$(UID3)
65 E32FLAGS += --capability=none --fpu=softvfp --targettype=EXE
66 E32FLAGS += --output=$(NAME).exe --elfinput=$(NAME).elf.exe
67 E32FLAGS += --stack=$(STACK)
68 E32FLAGS += --heap=$(HEAP)
69 E32FLAGS += --linkas=$(NAME){000a0000}[$(UID3)].exe --libpath=$(EPOCREL)/lib
71 EPOCRCFLAGS += -I../inc -I- -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/variant -DLANGUAGE_SC
73 ICONS ?= $(shell echo ../data/appicon/*.bmp)
74 APPICON ?= $(NAME)appicon.mbm
78 SRCH += $(shell echo ../inc/*.h)
79 SRC += $(shell echo ../src/*.cpp)
80 SRCRES ?= $(shell echo $(RSCDIR)/*.rss $(RSCDIR)/*.rls $(REGDIR)/*.rss $(REGDIR)/*.rls)
83 .PHONY : all mbm icon_mbm rsc reg loc bin sis run
93 $(NAME)appicon.mbg $(NAME)appicon.mbm : $(ICONS)
94 @echo "Creating multibitmap file..."
95 $(BMCONV) /h$(NAME)appicon.mbg $(NAME)appicon.mbm \
96 /c24../data/appicon/icon_small.bmp\
97 /8../data/appicon/icon_small_mask.bmp\
98 /c24../data/appicon/icon_large.bmp\
99 /8../data/appicon/icon_large_mask.bmp\
100 /c24../data/appicon/icon_xlarge.bmp\
101 /8../data/appicon/icon_xlarge_mask.bmp
103 rsc : $(RSCDIR)/$(NAME).rsc
105 $(RSCDIR)/$(NAME).rsc : $(RSCDIR)/$(NAME).rss # $(RSCDIR)/$(NAME).rls
106 @echo "Creating $@ ..."
107 $(EPOCRC) $(EPOCRCFLAGS) -I$(RSCDIR) -u $(RSCDIR)/$(NAME).rss \
108 -o$(RSCDIR)/$(NAME).rsc -h$(RSCDIR)/$(NAME).rsg -t/tmp -l$(RSCDIR)
110 reg : $(REGDIR)/$(NAME)_reg.rsc
112 $(REGDIR)/$(NAME)_reg.rsc : $(REGDIR)/$(NAME)_reg.rss
113 @echo "Creating $@ ..."
114 RC_UID2=0x101f8021 RC_UID3=0x$(UID3) $(EPOCRC) $(EPOCRCFLAGS) -I$(REGDIR) \
115 -u $(REGDIR)/$(NAME)_reg.rss -o$(REGDIR)/$(NAME)_reg.rsc -h$(REGDIR)/$(NAME)_reg.rsg -t/tmp -l$(REGDIR)
117 loc : $(REGDIR)/$(NAME)_loc.rsc
119 $(REGDIR)/$(NAME)_loc.rsc : $(REGDIR)/$(NAME)_loc.rss
120 @echo "Creating $@ ..."
121 $(EPOCRC) $(EPOCRCFLAGS) -I$(REGDIR) \
122 -u $(REGDIR)/$(NAME)_loc.rss -o$(REGDIR)/$(NAME)_loc.rsc -h$(REGDIR)/$(NAME)_loc.rsg -t/tmp -l$(REGDIR)
126 $(ELF2E32) $(E32FLAGS)
128 bin_elf : $(NAME).elf.exe
130 $(NAME).elf.exe : $(OBJ) $(EXTRALIB)
132 $(LD) $(LDFLAGS) $(OBJ) $(EXTRALIB) $(LDFLAGS2)
135 @echo "Compiling $< ..."
136 $(CXX) $(CXXFLAGS) -o $@ $<
138 $(NAME).sis : icon_mbm mbm rsc reg loc bin
141 mv $(NAME).SIS $(NAME).sis
143 #cat $(EPOCROOT)/extra/in.pkg extra.pkg | \
144 # sed "s:APPNAME:$(APPNAME):g" | \
145 # sed "s:NAME:$(NAME):g" | \
146 # sed "s:VER_MAJ:$(VER_MAJ):g" | \
147 # sed "s:VER_MIN:$(VER_MIN):g" | \
148 # sed "s:UID3:$(UID3):g" | \
149 # sed "s:VENDOR:$(VENDOR):g" > $(NAME).pkg
152 xterm -e "to-phone m600 $(NAME).sis"
156 .deps : $(SRC) $(SRCH)
158 $(CXX) -M -DDEPS $(SRC) $(CXXFLAGS) >> $@
161 rm -f $(NAME).exe $(NAME).elf.exe $(OBJ) tags .deps $(NAME).exe.map
162 rm -f *.bkp ../src/*.bkp ../inc/*.bkp $(RSCDIR)/*.bkp $(REGDIR)/*.bkp
163 rm -f $(RSCDIR)/*.rsc $(RSCDIR)/*.rsg
164 rm -f $(REGDIR)/*.rsc $(REGDIR)/*.rsg
165 rm -f $(APPICON) $(NAME)appicon.mbg $(NAME).mbg