6221f3f083fea1b76dc4a05184d591e6fd8fce71
[picodrive.git] / platform / uiq3 / uiq3.mak
1 #######################################################################
2 ### App specific part - this must be defined
3 #NAME="AnimatedStereogram"
4 #VENDOR="Pal Szasz"
5 #UID2=100039CE
6 #UID3=E0004201
7 #EPOCLIBS="euser.lib apparc.lib cone.lib eikcore.lib eikcoctl.lib qikcore.lib fbscli.lib estlib.lib"
8 #EPOCROOT=/opt/space/uiq3/
9 #######################################################################
10
11 APPNAME ?= "UIQ3 Program"
12 VENDOR ?= "Somebody"
13 UID2 ?= 100039CE
14 UID3 ?= E0001001
15 VER_MAJ ?= 1
16 VER_MIN ?= 0
17 STACK ?= 0x1000
18 HEAP ?= 0x1000,0x100000
19 EPOCROOT ?= /opt/space/uiq3/
20 GCCPREF ?= arm-none-symbianelf
21 GCCPATH ?= $(EPOCROOT)/gcc
22 GCCVER ?= 3.4.3
23
24 export EPOCROOT
25
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
30 CC = $(GCCPREF)-gcc
31 CXX = $(GCCPREF)-g++
32 AS = $(GCCPREF)-as
33 LD = $(GCCPREF)-ld
34 ELF2E32 = elf2e32
35 BMCONV = bmconv
36 EPOCRC = EPOCROOT=$(EPOCROOT) epocrc
37
38 PATH := $(EPOCROOT)/bin:$(GCCPATH)/bin:$(GCCPATH)/$(GCCPREF)/bin:$(PATH)
39
40 # TODO: do we really need -mapcs?
41 # -march=armv5t
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
51
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
63
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
70
71 EPOCRCFLAGS += -I../inc -I- -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/variant -DLANGUAGE_SC
72
73 ICONS ?= $(shell echo ../data/appicon/*.bmp)
74 APPICON ?= $(NAME)appicon.mbm
75 RSCDIR ?= ../rsc
76 REGDIR ?= ../reg
77
78 SRCH += $(shell echo ../inc/*.h)
79 SRC += $(shell echo ../src/*.cpp)
80 SRCRES ?= $(shell echo $(RSCDIR)/*.rss $(RSCDIR)/*.rls $(REGDIR)/*.rss $(REGDIR)/*.rls)
81 OBJ ?= $(SRC:.cpp=.o)
82
83 .PHONY : all mbm icon_mbm rsc reg loc bin sis run
84
85 #all : sis
86
87 sis : $(NAME).sis
88
89 icon_mbm : $(APPICON)
90
91 mbm :
92
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
102
103 rsc : $(RSCDIR)/$(NAME).rsc
104
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)
109
110 reg : $(REGDIR)/$(NAME)_reg.rsc
111
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)
116
117 loc : $(REGDIR)/$(NAME)_loc.rsc
118
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)
123
124 bin : bin_elf
125         @echo "Elf -> E32"
126         $(ELF2E32) $(E32FLAGS)
127
128 bin_elf : $(NAME).elf.exe
129
130 $(NAME).elf.exe : $(OBJ) $(EXTRALIB)
131         @echo "Linking..."
132         $(LD) $(LDFLAGS) $(OBJ) $(EXTRALIB) $(LDFLAGS2)
133
134 .cpp.o :
135         @echo "Compiling $< ..."
136         $(CXX) $(CXXFLAGS) -o $@ $<
137
138 $(NAME).sis : icon_mbm mbm rsc reg loc bin
139         rm -f $(NAME).sis
140         makesis $(NAME).pkg
141         mv $(NAME).SIS $(NAME).sis
142
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
150
151 run : sis
152         xterm -e "to-phone m600 $(NAME).sis"
153
154 -include .deps
155
156 .deps : $(SRC) $(SRCH)
157         echo > $@
158         $(CXX) -M -DDEPS $(SRC) $(CXXFLAGS) >> $@
159
160 clean :
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
166
167