/ Makefile
Makefile
1 # Copyright © 2013 Jeff Epler <jepler@unpythonic.net> 2 # 3 # This program is free software; you can redistribute it and/or modify 4 # it under the terms of the GNU General Public License as published by 5 # the Free Software Foundation; either version 2 of the License, or 6 # (at your option) any later version. 7 # 8 # This program is distributed in the hope that it will be useful, 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # GNU General Public License for more details. 12 # 13 # You should have received a copy of the GNU General Public License 14 # along with this program; if not, write to the Free Software 15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 17 pyconfig = $(shell python3 -c \ 18 'from distutils import sysconfig; print(sysconfig.$(1))') 19 20 CXXFLAGS_PYTHON := -DANA_AS_PYMODULE \ 21 -I $(call pyconfig, get_python_inc(False)) \ 22 -I $(call pyconfig, get_python_inc(True)) \ 23 -fPIC 24 25 LFLAGS_PYTHON := \ 26 -shared \ 27 $(call pyconfig, get_config_var("LIBS")) 28 29 CXX := g++ 30 CXXFLAGS := -g -std=c++11 -Wall 31 EXTRAFLAGS ?= 32 33 .PHONY: all 34 all: ana python dict.bin 35 36 .PHONY: python 37 python: ana.so 38 39 ana.js: $(wildcard *.cc) $(wildcard *.h) Makefile words 40 em++ -flto -O3 -g --bind -std=c++11 -s TOTAL_MEMORY=33554432 --preload-file words -DANA_AS_JS run.cc -o ana.js 41 42 words: 43 LANG=C.UTF-8 grep '^[a-z]*$$' /usr/share/dict/words > $@ 44 45 dict.bin: words ana 46 ./ana -D $@ -d $< 47 48 ana: $(wildcard *.cc) | $(wildcard *.h) Makefile 49 $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) -flto -o $@ $^ 50 ana.so: $(wildcard *.cc) | $(wildcard *.h) Makefile 51 $(CXX) $(CXXFLAGS) $(CXXFLAGS_PYTHON) -o $@ $^ $(LFLAGS_PYTHON) 52 53 publish: ana.js ana.html ana.js.mem ana.data 54 git branch -D gh-pages || true 55 ./import $(filter-out ana.html,$^) index.html=ana.html | git fast-import --date-format=now 56 57 .PHONY: clean 58 clean: 59 rm -f ana ana.so dict.bin words ana.js