source: branches/philmoz/Makefile @ 1357

Revision 1357, 9.3 KB checked in by philmoz, 20 months ago (diff)

Another method of simplifying the batch build for all camera/firmware versions. This version stores the camera / firmware info in the 'camera_list.csv' file which is then processed for doing batch builds (by auto_build.sh).

  • Property svn:eol-style set to LF
Line 
1topdir=./
2srcdir=./
3
4include makefile.inc
5
6SUBDIRS=tools lib platform core loader CHDK
7
8all: all-recursive
9
10clean: clean-recursive
11
12distclean: distclean-recursive
13
14.PHONY: fir
15fir: version firsub
16
17firsub: all
18        mkdir -p  $(topdir)bin
19        cp $(topdir)loader/$(PLATFORM)/main.bin  $(topdir)bin/main.bin
20ifndef NOZERO100K
21ifeq ($(OSTYPE),Windows)
22        zero | dd bs=1k count=100 >>  $(topdir)bin/main.bin 2> $(DEVNULL)
23else
24        dd if=/dev/zero bs=1k count=100 >>  $(topdir)bin/main.bin 2> $(DEVNULL)
25endif
26endif
27ifdef PLATFORMOS
28  ifeq ($(PLATFORMOS),vxworks)
29        @echo \-\> PS.FIR
30        $(PAKWIF) $(topdir)bin/PS.FIR $(topdir)bin/main.bin $(PLATFORMID) 0x01000101
31  endif
32  ifeq ($(PLATFORMOS),dryos)
33ifdef OPT_FI2
34  ifdef FI2KEY
35                @echo \-\> PS.FI2
36                $(PAKFI2)  $(topdir)bin/main.bin -p $(PLATFORMID) -key $(FI2KEY) -iv $(FI2IV)  $(topdir)bin/PS.FI2
37  else
38                @echo WARNING OPT_FI2 set but FI2KEY is not! please read platform/fi2.inc.txt
39  endif
40endif
41  endif
42endif
43ifdef NEED_ENCODED_DISKBOOT
44        @echo dance \-\> DISKBOOT.BIN ver $(NEED_ENCODED_DISKBOOT)
45        $(ENCODE_DISKBOOT) $(topdir)bin/main.bin  $(topdir)bin/DISKBOOT.BIN $(NEED_ENCODED_DISKBOOT)
46        rm  $(topdir)bin/main.bin
47else
48        mv  $(topdir)bin/main.bin  $(topdir)bin/DISKBOOT.BIN
49endif
50        @echo "**** Firmware creation completed successfully"
51
52.PHONY: upload
53upload: fir
54        @echo Uploading...
55        cp $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB).FIR $(topdir)bin/PS.FIR
56        /home/vitalyb/Projects/ch/libptp2-1.1.0/src/ptpcam -u -m 0xbf01 --filename $(topdir)bin/PS.FIR
57
58infoline:
59        @echo "**** GCC $(GCC_VERSION) : BUILDING CHDK-$(VER), #$(BUILD_NUMBER)$(STATE) FOR $(PLATFORM)-$(PLATFORMSUB)"
60
61version: FORCE
62        echo "**** Build: $(BUILD_NUMBER)"
63
64FORCE:
65
66firzip: version firzipsub
67
68firzipsub: infoline clean firsub
69        @echo \-\> $(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip
70        rm -f $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip
71        LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER) date:`date -R`" | \
72            zip -9jz $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/DISKBOOT.BIN > $(DEVNULL)
73ifdef PLATFORMOS
74  ifeq ($(PLATFORMOS),vxworks)
75        zip -9j $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/PS.FIR > $(DEVNULL)
76        rm -f $(topdir)bin/PS.FIR
77  endif
78  ifeq ($(PLATFORMOS),dryos)
79    ifdef OPT_FI2
80      ifdef FI2KEY
81            zip -9j $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/PS.FI2 > $(DEVNULL)
82            rm -f $(topdir)bin/PS.FI2
83      endif
84    endif
85  endif
86endif
87# if COPY_TO is defined then copy this camera/firmware version to the copied firmware version
88# Define COPY_TO in $(topdir)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc of the source
89# firmware version that needs to be copied to another firmware version
90ifdef COPY_TO
91        cp $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/$(VER)-$(PLATFORM)-$(COPY_TO)-$(BUILD_NUMBER)$(STATE).zip
92endif
93        rm -f $(topdir)bin/DISKBOOT.BIN
94
95
96firzipsubcomplete: infoline clean firsub
97        @echo \-\> $(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip
98        rm -f $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip
99        @echo \-\> $(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip
100        rm -f $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip
101        LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER)$(STATE) date:`date -R`" | \
102        zip -9jz $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)bin/DISKBOOT.BIN > $(DEVNULL)
103        LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER)$(STATE) date:`date -R`" | \
104        zip -9jz $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/DISKBOOT.BIN > $(DEVNULL)
105        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SYMBOLS/*  > $(DEVNULL)
106        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/BOOKS/*  > $(DEVNULL)
107        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/CURVES/*  > $(DEVNULL)
108        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/DATA/*  > $(DEVNULL)
109        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/FONTS/*  > $(DEVNULL)
110        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/GAMES/*   > $(DEVNULL)
111        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/GRIDS/* > $(DEVNULL)
112        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/LANG/*   > $(DEVNULL)
113        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/LUALIB/*   > $(DEVNULL)
114        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/LUALIB/GEN/*   > $(DEVNULL)
115        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/*  > $(DEVNULL)
116        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/EXAM/*     > $(DEVNULL)
117        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/TEST/*     > $(DEVNULL)
118        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/4Pack/*    > $(DEVNULL)
119        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/4Pack/Lua/*        > $(DEVNULL)
120        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/4Pack/uBasic/*     > $(DEVNULL)
121        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/syscurves.CVF      > $(DEVNULL)
122        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)doc/changelog.txt  > $(DEVNULL)
123        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)doc/changelog.txt  > $(DEVNULL)
124        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)tools/vers.req  > $(DEVNULL)
125        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
126        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)doc/readme.txt  > $(DEVNULL)
127        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)doc/readme.txt  > $(DEVNULL)
128
129ifdef PLATFORMOS
130  ifeq ($(PLATFORMOS),vxworks)
131        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)bin/PS.FIR > $(DEVNULL)
132        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/PS.FIR > $(DEVNULL)
133        rm -f $(topdir)bin/PS.FIR
134  endif
135  ifeq ($(PLATFORMOS),dryos)
136    ifdef OPT_FI2
137      ifdef FI2KEY
138            zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)bin/PS.FI2 > $(DEVNULL)
139            zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/PS.FI2 > $(DEVNULL)
140            rm -f $(topdir)bin/PS.FI2
141      endif
142    endif
143  endif
144endif
145# if COPY_TO is defined then copy this camera/firmware version to the copied firmware version
146# Define COPY_TO in $(topdir)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc of the source
147# firmware version that needs to be copied to another firmware version
148ifdef COPY_TO
149        cp $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)bin/$(PLATFORM)-$(COPY_TO)-$(BUILD_NUMBER)-full$(STATE).zip
150        cp $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/$(PLATFORM)-$(COPY_TO)-$(BUILD_NUMBER)$(STATE).zip
151endif
152        rm -f $(topdir)bin/DISKBOOT.BIN
153
154
155# define targets to batch build all cameras & firmware versions
156# list of cameras/firmware versions is in 'camera_list.csv'
157# each row in 'camera_list.csv' has 5 entries:
158# - camera (mandatory)         :- name of camera to build
159# - firmware (mandatory)       :- firmware version to build
160# - beta status (optional)     :- set to BETA for cameras still in beta status
161# - copy to (optional)         :- if this firmware version can also be used for another version on the same
162#                                 camera define the alternate firmware here. see COPY_TO comments above.
163# - skip auto build (optional) :- any value in this column will exclude the camera/firmware from the auto build
164batch-zip: version
165        sh auto_build.sh $(MAKE) firzipsub camera_list.csv
166        @echo "**** Summary of memisosizes"
167        cat $(topdir)bin/caminfo.txt
168        rm -f $(topdir)bin/caminfo.txt   > $(DEVNULL)
169
170batch-zip-complete: version
171        sh auto_build.sh $(MAKE) firzipsubcomplete camera_list.csv
172        @echo "**** Summary of memisosizes"
173        cat $(topdir)bin/caminfo.txt
174        rm -f $(topdir)bin/caminfo.txt   > $(DEVNULL)
175
176batch-clean:
177        sh auto_build.sh $(MAKE) clean camera_list.csv
178
179
180# Define empty recipes for all the included makefiles (including this one)
181# This stops gmake from attempting to see if the makefiles need to be rebuilt
182Makefile: ;
183makefile.inc: ;
184version.inc: ;
185buildconf.inc: ;
186localbuildconf.inc: ;
187$(topdir)/platform/fi2.inc: ;
188$(topdir)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc: ;
Note: See TracBrowser for help on using the repository browser.