Skip to content

Commit

Permalink
Polish makefile, again
Browse files Browse the repository at this point in the history
  • Loading branch information
perklet committed Feb 1, 2024
1 parent 02f1d69 commit afc9ac7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ curl_cffi.egg-info/
curl-*/
*.tar.xz
*.tar.gz
.patched
.preprocessed
include/
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,31 @@ $(CURL_VERSION):
-o "$(CURL_VERSION).tar.xz"
tar -xf $(CURL_VERSION).tar.xz

curl-impersonate-$(VERSION)/chrome/patches: $(CURL_VERSION)
curl -L "https://github.com/yifeikong/curl-impersonate/archive/refs/tags/v$(VERSION).tar.gz" \
-o "curl-impersonate-$(VERSION).tar.gz"
tar -xf curl-impersonate-$(VERSION).tar.gz

curl_cffi/include/curl/curl.h: $(CURL_VERSION)
.preprocessed: curl-impersonate-$(VERSION)/chrome/patches
cd $(CURL_VERSION)
for p in $</curl-*.patch; do patch -p1 < ../$$p; done
# Re-generate the configure script
autoreconf -fi
mkdir -p ../curl_cffi/include/curl
cp -R include/curl/* ../curl_cffi/include/curl/
# Sentinel files: https://tech.davis-hansson.com/p/make/
touch .preprocessed

preprocess: curl_cffi/include/curl/curl.h
gen-const: .preprocessed
python scripts/generate_consts.py $(CURL_VERSION)

preprocess: .preprocessed
@echo generating patched libcurl header files

install-editable: curl_cffi/include/curl/curl.h
install-editable: .preprocessed
pip install -e .

build: curl_cffi/include/curl/curl.h
build: .preprocessed
rm -rf dist/
pip install build
python -m build --wheel
Expand All @@ -40,4 +46,4 @@ clean:
rm -rf $(CURL_VERSION).tar.xz curl-impersonate-$(VERSION).tar.gz
rm -rf curl_cffi/include/

.PHONY: clean build test install-editable preprocess
.PHONY: clean build test install-editable preprocess gen-const

0 comments on commit afc9ac7

Please sign in to comment.