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