Rev 10 | Rev 12 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 10 | Rev 11 | ||
|---|---|---|---|
| Line 166... | Line 166... | ||
| 166 | define make_stamp |
166 | define make_stamp |
| 167 | @[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR) |
167 | @[ -d $(STAMP_DIR) ] || mkdir $(STAMP_DIR) |
| 168 | date > $(STAMP_DIR)/$(1) |
168 | date > $(STAMP_DIR)/$(1) |
| 169 | endef |
169 | endef |
| 170 | 170 | ||
| - | 171 | define GET_MY_VARS |
|
| - | 172 | UP_$(1):=$$(shell echo "$(1)" | tr '[a-z]' '[A-Z]') |
|
| - | 173 | MY_ARCHIVE:=$$($$(UP_$(1))_ARCHIVE) |
|
| - | 174 | MY_URL:=$$($$(UP_$(1))_URL) |
|
| - | 175 | MY_MD5:=$$($$(UP_$(1))_MD5) |
|
| - | 176 | endef |
|
| - | 177 | ||
| 171 | ## create the download rule and force download rule |
178 | ## create the download rule and force download rule |
| 172 | define DOWNLOAD_template |
179 | define DOWNLOAD_template |
| - | 180 | $(call GET_MY_VARS,$(1)) |
|
| 173 | download-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE) |
181 | download-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
| 174 | download-$(1)-f $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE): $(DOWNLOAD_DIR) |
182 | download-$(1)-f $(DOWNLOAD_DIR)/$$(MY_ARCHIVE): $(DOWNLOAD_DIR) |
| 175 | cd $(DOWNLOAD_DIR) && curl -LO $$($(1)_URL) |
183 | cd $(DOWNLOAD_DIR) && curl -LO $$(MY_URL) |
| 176 | PHONY += download-$(1) download-$(1)-f |
184 | PHONY += download-$(1) download-$(1)-f |
| 177 | endef |
185 | endef |
| 178 | 186 | ||
| 179 | ## extract commands |
187 | ## extract commands |
| 180 | EXT_BZ2 := tar -jxf |
188 | EXT_BZ2 := tar -jxf |
| 181 | EXT_TGZ := tar -xf |
189 | EXT_TGZ := tar -xf |
| 182 | EXT_ZIP := unzip -o |
190 | EXT_ZIP := unzip -o |
| 183 | 191 | ||
| 184 | ## create the extract rule and force extract rule |
192 | ## create the extract rule and force extract rule |
| 185 | define EXTRACT_template |
193 | define EXTRACT_template |
| - | 194 | $(call GET_MY_VARS,$(1)) |
|
| 186 | extract-$(1): $(STAMP_DIR)/extract-$(1) |
195 | extract-$(1): $(STAMP_DIR)/extract-$(1) |
| 187 | extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$($(1)_ARCHIVE) |
196 | extract-$(1)-f $(STAMP_DIR)/extract-$(1): $(DOWNLOAD_DIR)/$$(MY_ARCHIVE) |
| 188 | @(rm -rf autoconf-*; \ |
197 | @(rm -rf autoconf-*; \ |
| 189 | t1=`openssl md5 $$< | cut -f 2 -d " " -` && \ |
198 | t1=`openssl md5 $$< | cut -f 2 -d " " -` && \ |
| 190 | [ "$$$$t1" = "$$($(1)_MD5)" ] || \ |
199 | [ "$$$$t1" = "$$(MY_MD5)" ] || \ |
| 191 | ( echo "Bad Checksum! Please remove the following file and retry: $$<" && false )) |
200 | ( echo "Bad Checksum! Please remove the following file and retry: $$<" && false )) |
| 192 | $(call quiet_text,"Extracting $$($(1)_ARCHIVE)") |
201 | $(call quiet_text,"Extracting $$(MY_ARCHIVE)") |
| 193 | $($(2)) $$< |
202 | $($(2)) $$< |
| 194 | $(call make_stamp,extract-$(1)) |
203 | $(call make_stamp,extract-$(1)) |
| 195 | PHONY += extract-$(1) extract-$(1)-f |
204 | PHONY += extract-$(1) extract-$(1)-f |
| 196 | endef |
205 | endef |
| 197 | 206 | ||
| 198 | $(DOWNLOAD_DIR): |
207 | $(DOWNLOAD_DIR): |
| 199 | mkdir $(DOWNLOAD_DIR) |
208 | mkdir $(DOWNLOAD_DIR) |
| 200 | 209 | ||
| 201 | $(eval $(call DOWNLOAD_template,AUTOCONF)) |
210 | $(eval $(call DOWNLOAD_template,autoconf)) |
| 202 | $(eval $(call EXTRACT_template,AUTOCONF,EXT_BZ2)) |
211 | $(eval $(call EXTRACT_template,autoconf,EXT_BZ2)) |
| 203 | 212 | ||
| 204 | .PHONY: $(PHONY) |
213 | .PHONY: $(PHONY) |
| 205 | 214 | ||
| 206 | 215 | ||
| 207 | .PHONY: tst2 tst3 |
216 | .PHONY: tst2 tst3 |