| 1 | topdir=./ |
|---|
| 2 | srcdir=./ |
|---|
| 3 | |
|---|
| 4 | include makefile.inc |
|---|
| 5 | |
|---|
| 6 | SUBDIRS=tools lib platform core loader CHDK |
|---|
| 7 | |
|---|
| 8 | all: all-recursive |
|---|
| 9 | |
|---|
| 10 | clean: clean-recursive |
|---|
| 11 | |
|---|
| 12 | distclean: distclean-recursive |
|---|
| 13 | |
|---|
| 14 | .PHONY: fir |
|---|
| 15 | fir: version firsub |
|---|
| 16 | |
|---|
| 17 | firsub: all |
|---|
| 18 | mkdir -p $(topdir)bin |
|---|
| 19 | cp $(topdir)loader/$(PLATFORM)/main.bin $(topdir)bin/main.bin |
|---|
| 20 | ifndef NOZERO100K |
|---|
| 21 | ifeq ($(OSTYPE),Windows) |
|---|
| 22 | zero | dd bs=1k count=100 >> $(topdir)bin/main.bin 2> $(DEVNULL) |
|---|
| 23 | else |
|---|
| 24 | dd if=/dev/zero bs=1k count=100 >> $(topdir)bin/main.bin 2> $(DEVNULL) |
|---|
| 25 | endif |
|---|
| 26 | endif |
|---|
| 27 | ifdef 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) |
|---|
| 33 | ifdef 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 |
|---|
| 40 | endif |
|---|
| 41 | endif |
|---|
| 42 | endif |
|---|
| 43 | ifdef 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 |
|---|
| 47 | else |
|---|
| 48 | mv $(topdir)bin/main.bin $(topdir)bin/DISKBOOT.BIN |
|---|
| 49 | endif |
|---|
| 50 | @echo "**** Firmware creation completed successfully" |
|---|
| 51 | |
|---|
| 52 | .PHONY: upload |
|---|
| 53 | upload: 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 | |
|---|
| 58 | infoline: |
|---|
| 59 | @echo "**** GCC $(GCC_VERSION) : BUILDING CHDK-$(VER), #$(BUILD_NUMBER)$(STATE) FOR $(PLATFORM)-$(PLATFORMSUB)" |
|---|
| 60 | |
|---|
| 61 | version: FORCE |
|---|
| 62 | echo "**** Build: $(BUILD_NUMBER)" |
|---|
| 63 | |
|---|
| 64 | FORCE: |
|---|
| 65 | |
|---|
| 66 | firzip: version firzipsub |
|---|
| 67 | |
|---|
| 68 | firzipsub: 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) |
|---|
| 73 | ifdef 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 |
|---|
| 86 | endif |
|---|
| 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 |
|---|
| 90 | ifdef COPY_TO |
|---|
| 91 | cp $(topdir)bin/$(VER)-$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/$(VER)-$(PLATFORM)-$(COPY_TO)-$(BUILD_NUMBER)$(STATE).zip |
|---|
| 92 | endif |
|---|
| 93 | rm -f $(topdir)bin/DISKBOOT.BIN |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | firzipsubcomplete: 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 | |
|---|
| 129 | ifdef 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 |
|---|
| 144 | endif |
|---|
| 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 |
|---|
| 148 | ifdef 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 |
|---|
| 151 | endif |
|---|
| 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 |
|---|
| 164 | batch-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 | |
|---|
| 170 | batch-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 | |
|---|
| 176 | batch-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 |
|---|
| 182 | Makefile: ; |
|---|
| 183 | makefile.inc: ; |
|---|
| 184 | version.inc: ; |
|---|
| 185 | buildconf.inc: ; |
|---|
| 186 | localbuildconf.inc: ; |
|---|
| 187 | $(topdir)/platform/fi2.inc: ; |
|---|
| 188 | $(topdir)/platform/$(PLATFORM)/sub/$(PLATFORMSUB)/makefile.inc: ; |
|---|