root/trunk/Makefile @ 1903

Revision 1903, 10.0 KB (checked in by reyalp, 13 months ago)

allow user specified camera list for batch builds, e.g. make CAMERA_LIST=mycams.csv batch-zip

  • Property svn:eol-style set to LF
Line 
1topdir=./
2srcdir=./
3
4tmp:=$(shell echo "BUILD_SVNREV := $(DEF_SVN_REF)" > revision.inc)
5
6# can override on command line or *buildconf.inc for custom subsets
7CAMERA_LIST=camera_list.csv
8
9include makefile.inc
10
11BUILD_SVNREV:=$(shell svnversion -cn $(topdir) | $(ESED) 's/[0-9]*:([0-9]+)[MPS]*/\1/')
12ifeq ($(BUILD_SVNREV), )
13        BUILD_SVNREV:=$(DEF_SVN_REF)
14endif
15#for CHDK-Shell up to svn revision 1.6
16ifeq ($(BUILD_SVNREV), exported)
17        BUILD_SVNREV:=$(DEF_SVN_REF)
18endif
19ifeq ($(BUILD_SVNREV), exportiert)
20        BUILD_SVNREV:=$(DEF_SVN_REF)
21endif
22#for CHDK-Shell svn revision 1.7
23ifeq ($(BUILD_SVNREV), Unversioned directory)
24        BUILD_SVNREV:=$(DEF_SVN_REF)
25endif
26tmp:=$(shell echo "BUILD_SVNREV := $(BUILD_SVNREV)" > revision.inc)
27
28# CHDK folder for full package
29ZIPDIRS:=$(shell ls -R CHDK | grep CHDK/ | $(ESED) 's?:?/*?')
30
31SUBDIRS=lib platform core loader CHDK
32
33# SKIP_TOOLS prevents re-building tools in root level make, to speed up batch builds
34ifndef SKIP_TOOLS
35SUBDIRS+=tools
36endif
37
38.PHONY: fir
39fir: version firsub
40
41
42firsub: all
43        mkdir -p $(topdir)bin
44        mkdir -p  $(topdir)CHDK/MODULES
45        cp $(topdir)loader/$(PLATFORM)/main.bin $(topdir)bin/main.bin
46    ifndef NOZERO100K
47        ifeq ($(OSTYPE),Windows)
48                        zero | dd bs=1k count=100 >> $(topdir)bin/main.bin 2> $(DEVNULL)
49        else
50                        dd if=/dev/zero bs=1k count=100 >> $(topdir)bin/main.bin 2> $(DEVNULL)
51        endif
52    endif
53    ifdef PLATFORMOS
54        ifeq ($(PLATFORMOS),vxworks)
55                        @echo \-\> PS.FIR
56                        $(PAKWIF) $(topdir)bin/PS.FIR $(topdir)bin/main.bin $(PLATFORMID) 0x01000101
57        endif
58        ifeq ($(PLATFORMOS),dryos)
59            ifdef OPT_FI2
60                ifdef FI2KEY
61                                        @echo \-\> PS.FI2
62                                        $(PAKFI2) $(topdir)bin/main.bin -p $(PLATFORMID) -pv $(PLATFORMOSVER) -key $(FI2KEY) -iv $(FI2IV) $(topdir)bin/PS.FI2
63                else
64                                        @echo WARNING OPT_FI2 set but FI2KEY is not! please read platform/fi2.inc.txt
65                endif
66            endif
67        endif
68    endif
69    ifdef NEED_ENCODED_DISKBOOT
70                @echo dance \-\> DISKBOOT.BIN ver $(NEED_ENCODED_DISKBOOT)
71                $(ENCODE_DISKBOOT) $(topdir)bin/main.bin  $(topdir)bin/DISKBOOT.BIN $(NEED_ENCODED_DISKBOOT)
72                rm $(topdir)bin/main.bin
73    else
74                mv $(topdir)bin/main.bin  $(topdir)bin/DISKBOOT.BIN
75    endif
76        rm -f $(topdir)CHDK/MODULES/*
77        cp $(topdir)core/modules/*.flt $(topdir)CHDK/MODULES
78        @echo "**** Firmware creation completed successfully"
79
80
81.PHONY: upload
82upload: fir
83        @echo Uploading...
84        cp $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB).FIR $(topdir)bin/PS.FIR
85        /home/vitalyb/Projects/ch/libptp2-1.1.0/src/ptpcam -u -m 0xbf01 --filename $(topdir)bin/PS.FIR
86
87
88infoline:
89        @echo "**** GCC $(GCC_VERSION) : BUILDING CHDK-$(VER), #$(BUILD_NUMBER)$(STATE) FOR $(PLATFORM)-$(PLATFORMSUB)-$(BUILD_SVNREV)"
90
91.PHONY: version
92version: FORCE
93        echo "**** Build: $(BUILD_NUMBER)"
94
95
96.PHONY: FORCE
97FORCE:
98
99
100firzip: version firzipsub
101
102
103firzipsub: infoline clean firsub
104        @echo \-\> $(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip
105        rm -f $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip
106        LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER) date:`date -R`" | \
107                zip -9jz $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/DISKBOOT.BIN > $(DEVNULL)
108    ifdef PLATFORMOS
109        ifeq ($(PLATFORMOS),vxworks)
110                        zip -9j $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/PS.FIR > $(DEVNULL)
111                        rm -f $(topdir)bin/PS.FIR
112        endif
113        ifeq ($(PLATFORMOS),dryos)
114            ifdef OPT_FI2
115                ifdef FI2KEY
116                                        zip -9j $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/PS.FI2 > $(DEVNULL)
117                                        rm -f $(topdir)bin/PS.FI2
118                endif
119            endif
120        endif
121    endif
122        zip -9 $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)CHDK/MODULES/*
123    # if COPY_TO is defined then copy this camera/firmware version to the copied firmware version
124    # Define COPY_TO in $(topdir)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc of the source
125    # firmware version that needs to be copied to another firmware version
126        # For the case where one CHDK version applies to two or more other Canon firmware version place all the
127        # 'copy to' firmware versions together seperated by ':' - e.g. "a2000,100c,BETA,100a:100b,"
128    ifdef COPY_TO
129                @echo "**** Copying duplicate Firmwares"
130                $(foreach COPY_PLATFORMSUB, $(subst :, ,$(COPY_TO)), \
131                        cp $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/$(VER)-$(PLATFORM)-$(COPY_PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip ; \
132                )
133    endif
134        rm -f $(topdir)bin/DISKBOOT.BIN
135
136
137firzipsubcomplete: infoline clean firsub
138        @echo \-\> $(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip
139        rm -f $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip
140        @echo \-\> $(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip
141        rm -f $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip
142        LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER)$(STATE) date:`date -R`" | \
143        zip -9jz $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)bin/DISKBOOT.BIN > $(DEVNULL)
144        LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER)$(STATE) date:`date -R`" | \
145        zip -9jz $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/DISKBOOT.BIN > $(DEVNULL)
146        $(foreach ZIPDIR, $(ZIPDIRS), \
147                zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)$(ZIPDIR) > $(DEVNULL) ; \
148        )
149        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/syscurves.CVF      > $(DEVNULL)
150        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)doc/changelog.txt  > $(DEVNULL)
151        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)doc/changelog.txt  > $(DEVNULL)
152        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)tools/vers.req  > $(DEVNULL)
153        cat $(topdir)doc/1_intro.txt  $(topdir)platform/$(PLATFORM)/notes.txt $(topdir)doc/2_installation.txt $(topdir)doc/3_faq.txt $(topdir)doc/4_urls.txt $(topdir)doc/5_gpl.txt $(topdir)doc/6_ubasic_copyright.txt > $(topdir)doc/readme.txt
154        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)doc/readme.txt  > $(DEVNULL)
155        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)doc/readme.txt  > $(DEVNULL)
156        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)CHDK/MODULES/*  > $(DEVNULL)
157
158    ifdef PLATFORMOS
159        ifeq ($(PLATFORMOS),vxworks)
160                        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)bin/PS.FIR > $(DEVNULL)
161                        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/PS.FIR > $(DEVNULL)
162                        rm -f $(topdir)bin/PS.FIR
163        endif
164        ifeq ($(PLATFORMOS),dryos)
165            ifdef OPT_FI2
166                ifdef FI2KEY
167                                        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)bin/PS.FI2 > $(DEVNULL)
168                                        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/PS.FI2 > $(DEVNULL)
169                                        rm -f $(topdir)bin/PS.FI2
170                endif
171            endif
172        endif
173    endif
174    # if COPY_TO is defined then copy this camera/firmware version to the copied firmware version
175    # Define COPY_TO in $(topdir)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc of the source
176    # firmware version that needs to be copied to another firmware version
177        # For the case where one CHDK version applies to two or more other Canon firmware version place all the
178        # 'copy to' firmware versions together seperated by ':' - e.g. "a2000,100c,BETA,100a:100b,"
179    ifdef COPY_TO
180                @echo "**** Copying duplicate Firmwares"
181                $(foreach COPY_PLATFORMSUB, $(subst :, ,$(COPY_TO)), \
182                        cp $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)bin/$(PLATFORM)-$(COPY_PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip ; \
183                        cp $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/$(PLATFORM)-$(COPY_PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip ; \
184                )
185    endif
186        rm -f $(topdir)bin/DISKBOOT.BIN
187
188print-missing-dump:
189        if [ ! -s $(PRIMARY_ROOT)/$(PLATFORM)/sub/$(PLATFORMSUB)/PRIMARY.BIN ] ; then \
190                echo "missing primary for $(PLATFORM) $(PLATFORMSUB)" ; \
191        fi
192
193
194# for batch builds, build tools for vx and dryos once, instead of once for every firmware
195alltools:
196        $(MAKE) -C tools PLATFORM=a610 PLATFORMSUB=100e clean all
197        $(MAKE) -C tools PLATFORM=a720 PLATFORMSUB=100c clean all
198
199# define targets to batch build all cameras & firmware versions
200# list of cameras/firmware versions is in 'camera_list.csv'
201# each row in 'camera_list.csv' has 5 entries:
202# - camera (mandatory)         :- name of camera to build
203# - firmware (mandatory)       :- firmware version to build
204# - beta status (optional)     :- set to BETA for cameras still in beta status
205# - copy to (optional)         :- if this firmware version can also be used for another version on the same
206#                                 camera define the alternate firmware here. see COPY_TO comments above.
207# - skip auto build (optional) :- any value in this column will exclude the camera/firmware from the auto build
208
209batch-zip: version alltools
210        SKIP_TOOLS=1 sh tools/auto_build.sh $(MAKE) firzipsub $(CAMERA_LIST)
211        @echo "**** Summary of memisosizes"
212        cat $(topdir)bin/caminfo.txt
213        rm -f $(topdir)bin/caminfo.txt   > $(DEVNULL)
214
215batch-zip-complete: version alltools
216        SKIP_TOOLS=1 sh tools/auto_build.sh $(MAKE) firzipsubcomplete $(CAMERA_LIST)
217        @echo "**** Summary of memisosizes"
218        cat $(topdir)bin/caminfo.txt
219        rm -f $(topdir)bin/caminfo.txt   > $(DEVNULL)
220
221# make sure each enabled firmware/sub has a PRIMARY.BIN
222# Note this will not fail, just prints all the missing ones
223batch-print-missing-dumps:
224        sh tools/auto_build.sh $(MAKE) print-missing-dump $(CAMERA_LIST)
225
226batch-clean:
227        sh tools/auto_build.sh $(MAKE) clean $(CAMERA_LIST)
Note: See TracBrowser for help on using the browser.