Created
June 20, 2017 06:16
-
-
Save syfluqs/7696a7d507c5aa410dcf20a7b1ca8f96 to your computer and use it in GitHub Desktop.
A makefile for compiling python scripts to exe on windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PYTHONPATH:=C:\Python35 | |
PYTHONLIB:=python35 | |
.PHONY: build | |
build: | |
cython --embed $(file).py -o $(file).c | |
#Applying Wmain@16 linker error workaround patch | |
@sed 's/int wmain(int argc/int main(int argc/' $(file).c > cython_build_temp.c | |
gcc cython_build_temp.c -o $(file) -I $(PYTHONPATH)\include -L $(PYTHONPATH)\libs -l$(PYTHONLIB) | |
rm cython_build_temp.c | |
.PHONY: no_console_build | |
no_console_build: | |
cython --embed $(file).py -o $(file).c | |
#Applying Wmain@16 linker error workaround patch | |
@sed 's/int wmain(int argc/int main(int argc/' $(file).c > cython_build_temp.c | |
gcc cython_build_temp.c -o $(file) -I $(PYTHONPATH)\include -L $(PYTHONPATH)\libs -l$(PYTHONLIB) -Wl,--subsystem,windows | |
rm cython_build_temp.c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rename
cython_win_makefile.mak
tomakefile
Usage :
To build example.py
make build file=example
OR
make no_console_build file=example