platform ps2, handle audio similar to psp
[picodrive.git] / 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:$(PATH)
39
40 # -march=armv5t ?
41 CFLAGS += -Wall -pipe -nostdinc -msoft-float
42 CFLAGS += -DNDEBUG -D_UNICODE -D__GCCE__  -D__SYMBIAN32__ -D__EPOC32__ -D__MARM__
43 CFLAGS += -D__EABI__ -D__MARM_ARMV5__ -D__EXE__ -D__SUPPORT_CPP_EXCEPTIONS__ -D__MARM_ARMV5__
44 CFLAGS += -D__PRODUCT_INCLUDE__="$(EPOCROOT)/epoc32/include/variant/uiq_3.0.hrh"
45 CFLAGS += -include $(EPOCROOT)/epoc32/include/gcce/gcce.h
46 CFLAGS += -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/libc \
47                 -I$(EPOCROOT)/epoc32/include/variant -I$(GCCPATH)/lib/gcc/arm-none-symbianelf/$(GCCVER)/include/
48 # can't optimize .cpp without -fno-unit-at-a-time
49 CXXFLAGS += $(CFLAGS) -c -x c++ -mapcs -Wno-ctor-dtor-privacy -Wno-unknown-pragmas -fexceptions -fno-unit-at-a-time
50
51 LDFLAGS +=  -L$(GCCPATH)/lib -L$(GCCPATH)/lib/gcc/$(GCCPREF)/$(GCCVER) -L $(GCCPATH)/$(GCCPREF)/lib
52 LDFLAGS +=  --target1-abs --no-undefined -nostdlib  -shared
53 LDFLAGS +=  -Ttext 0x8000   -Tdata 0x400000 --default-symver
54 LDFLAGS +=  -soname $(NAME){000a0000}\[$(UID3)\].exe --entry _E32Startup -u _E32Startup
55 LDFLAGS +=  $(EPOCROOT)/epoc32/release/armv5/urel/eexe.lib
56 LDFLAGS +=  -o $(NAME).elf.exe -Map $(NAME).exe.map
57 LDFLAGS2 =  $(EPOCREL)/urel/qikalloc.lib $(EPOCREL)/lib/euser.dso
58 LDFLAGS2 += $(shell for i in $(EPOCLIBS); do echo -n " $(EPOCREL)/lib/$${i%%.lib}.dso "; done)
59 LDFLAGS2 += $(EPOCREL)/urel/usrt2_2.lib
60 LDFLAGS2 += $(shell for i in dfpaeabi dfprvct2_2 drtaeabi scppnwdl drtrvct2_2; do echo -n "  $(EPOCREL)/lib/$$i.dso "; done)
61 LDFLAGS2 += -lsupc++ -lgcc
62
63 E32FLAGS += --sid=0x$(UID3) --uid1=0x1000007a --uid2=0x$(UID2) --uid3=0x$(UID3)
64 E32FLAGS += --capability=none --fpu=softvfp --targettype=EXE
65 E32FLAGS += --output=$(NAME).exe --elfinput=$(NAME).elf.exe
66 E32FLAGS += --stack=$(STACK)
67 E32FLAGS += --heap=$(HEAP)
68 E32FLAGS += --linkas=$(NAME){000a0000}[$(UID3)].exe --libpath=$(EPOCREL)/lib
69
70 EPOCRCFLAGS += -I../inc -I- -I$(EPOCROOT)/epoc32/include -I$(EPOCROOT)/epoc32/include/variant -DLANGUAGE_SC
71
72 ICONS ?= $(shell echo ../data/appicon/*.bmp)
73 APPICON ?= $(NAME)appicon.mbm
74 RSCDIR ?= ../rsc
75 REGDIR ?= ../reg
76
77 SRCH += $(shell echo ../inc/*.h)
78 SRC += $(shell echo ../src/*.cpp)
79 SRCRES ?= $(shell echo $(RSCDIR)/*.rss $(RSCDIR)/*.rls $(REGDIR)/*.rss $(REGDIR)/*.rls)
80 OBJS ?= $(SRC:.cpp=.o)
81
82 .PHONY : all mbm icon_mbm rsc reg loc bin sis run
83
84 #all : sis
85
86 sis : $(NAME).sis
87
88 icon_mbm : $(APPICON)
89
90 mbm :
91
92 $(NAME)appicon.mbg $(NAME)appicon.mbm : $(ICONS)
93         @echo "Creating multibitmap file..."
94         $(BMCONV) /h$(NAME)appicon.mbg $(NAME)appicon.mbm \
95                 /c24../data/appicon/icon_small.bmp\
96                 /8../data/appicon/icon_small_mask.bmp\
97                 /c24../data/appicon/icon_large.bmp\
98                 /8../data/appicon/icon_large_mask.bmp\
99                 /c24../data/appicon/icon_xlarge.bmp\
100                 /8../data/appicon/icon_xlarge_mask.bmp
101
102 rsc : $(RSCDIR)/$(NAME).rsc
103
104 $(RSCDIR)/$(NAME).rsc : $(RSCDIR)/$(NAME).rss # $(RSCDIR)/$(NAME).rls
105         @echo "Creating $@ ..."
106         $(EPOCRC) $(EPOCRCFLAGS) -I$(RSCDIR) -u $(RSCDIR)/$(NAME).rss \
107                 -o$(RSCDIR)/$(NAME).rsc -h$(RSCDIR)/$(NAME).rsg -t/tmp -l$(RSCDIR)
108
109 reg : $(REGDIR)/$(NAME)_reg.rsc
110
111 $(REGDIR)/$(NAME)_reg.rsc : $(REGDIR)/$(NAME)_reg.rss
112         @echo "Creating $@ ..."
113         RC_UID2=0x101f8021 RC_UID3=0x$(UID3) $(EPOCRC) $(EPOCRCFLAGS) -I$(REGDIR) \
114                 -u $(REGDIR)/$(NAME)_reg.rss -o$(REGDIR)/$(NAME)_reg.rsc -h$(REGDIR)/$(NAME)_reg.rsg -t/tmp  -l$(REGDIR)
115
116 loc : $(REGDIR)/$(NAME)_loc.rsc
117
118 $(REGDIR)/$(NAME)_loc.rsc : $(REGDIR)/$(NAME)_loc.rss
119         @echo "Creating $@ ..."
120         $(EPOCRC) $(EPOCRCFLAGS) -I$(REGDIR) \
121                 -u $(REGDIR)/$(NAME)_loc.rss -o$(REGDIR)/$(NAME)_loc.rsc -h$(REGDIR)/$(NAME)_loc.rsg -t/tmp  -l$(REGDIR)
122
123 bin : bin_elf
124         @echo "Elf -> E32"
125         $(ELF2E32) $(E32FLAGS)
126
127 bin_elf : $(NAME).elf.exe
128
129 $(NAME).elf.exe : $(OBJS) $(EXTRALIB)
130         @echo "Linking..."
131         $(LD) $(LDFLAGS) $(OBJS) $(EXTRALIB) $(LDFLAGS2)
132
133 .cpp.o :
134         @echo "Compiling $< ..."
135         $(CXX) $(CXXFLAGS) -o $@ $<
136
137 $(NAME).sis : icon_mbm mbm rsc reg loc bin
138         rm -f $(NAME).sis
139         makesis $(NAME).pkg
140         mv $(NAME).SIS $(NAME).sis
141
142 #cat $(EPOCROOT)/extra/in.pkg extra.pkg | \
143 #               sed "s:APPNAME:$(APPNAME):g" | \
144 #               sed "s:NAME:$(NAME):g" | \
145 #               sed "s:VER_MAJ:$(VER_MAJ):g" | \
146 #               sed "s:VER_MIN:$(VER_MIN):g" | \
147 #               sed "s:UID3:$(UID3):g" | \
148 #               sed "s:VENDOR:$(VENDOR):g" > $(NAME).pkg
149
150 run : sis
151         xterm -e "to-phone m600 $(NAME).sis"
152
153 -include .deps
154
155 .deps : $(SRC) $(SRCH)
156         echo > $@
157         $(CXX) -M -DDEPS $(SRC) $(CXXFLAGS) >> $@
158
159 clean :
160         rm -f $(NAME).exe $(NAME).elf.exe $(OBJS) tags .deps $(NAME).exe.map
161         rm -f *.bkp ../src/*.bkp ../inc/*.bkp $(RSCDIR)/*.bkp $(REGDIR)/*.bkp
162         rm -f $(RSCDIR)/*.rsc $(RSCDIR)/*.rsg
163         rm -f $(REGDIR)/*.rsc $(REGDIR)/*.rsg
164         rm -f $(APPICON) $(NAME)appicon.mbg $(NAME).mbg
165
166