# ----------------------------------------------------------------------------- # this file: # https://dataswamp.org/~incal/bad-el/src/bad-sdl2/Makefile # ----------------------------------------------------------------------------- mkef = -j -s mcmd = $(MAKE) $(mkef) name = bad-sdl2 el = $(name).el elc = $(name).elc obj = $(name).o src = $(name).c so = $(name).so log = $(name).log stats = $(name).txt # ----------------------------------------------------------------------------- cc = gcc warn = -Wall -Wextra -pedantic-errors ccfl = -g --shared -fPIC $(warn) -I/usr/include/SDL2 -D_REENTRANT comp = $(cc) $(ccfl) libs = -lSDL2 -lSDL2_ttf -lssl -lcrypto # ----------------------------------------------------------------------------- all: $(elc) $(so) $(so): $(obj) $(comp) -o $@ $^ $(libs) %.o: %.c $(comp) -c $< -o $@ # ----------------------------------------------------------------------------- sed-filter = sed '/^\(Gtk|Loading\|\older|Wrote\)/d' filter = 2>&1 | $(sed-filter) filter-quiet = > /dev/null $(filter) $(elc): $(el) emacs --batch -L "." -L ".." -f batch-byte-compile $< $(filter-quiet) emacs --batch -L "." -L ".." -f batch-byte-compile $< $(filter) emacs --batch -L "." -L ".." -f batch-native-compile $< $(filter) # ----------------------------------------------------------------------------- clean: rm -f $(elc) $(obj) $(so) $(log) clear: $(mcmd) clean again: $(mcmd) clean $(mcmd) # ----------------------------------------------------------------------------- emacs_dbg_opts = -Q -D --module-assertions --eval "(setq debug-on-error t)" emacs_run_opts = -Q -D vo_opts = --quiet -s --log-file=$(log) --leak-check=full --track-origins=yes # ----------------------------------------------------------------------------- log: touch $(log) grep $(so) $(log) | sort -u meta: echo -n "threads: " ps --no-headers -T -p `pidof emacs` | wc -l ps --no-headers -T -p `pidof emacs` # ----------------------------------------------------------------------------- fps: $(elc) $(so) $(mcmd) --makefile ../Makefile emacs $(emacs_run_opts) -l $< -f sdl2-fps -f kill-emacs fps-debug: $(elc) $(so) $(mcmd) --makefile ../Makefile valgrind $(vg_opts) emacs $(emacs_dbg_opts) -l $< -f sdl2-fps -f kill-emacs $(mcmd) log # ----------------------------------------------------------------------------- stats: $(stats) cat $< solar-stats: $(elc) $(so) $(mcmd) --makefile ../Makefile pidstat -H -u -r -e emacs $(emacs_run_opts) -l $< -f sdl2-solar -f kill-emacs $(mcmd) $(stats) solar: $(elc) $(so) $(mcmd) --makefile ../Makefile emacs $(emacs_run_opts) -l $< -f sdl2-solar -f kill-emacs solar-debug: $(elc) $(so) $(mcmd) --makefile ../Makefile emacs $(emacs_dbg_opts) -l $< -f sdl2-solar -f kill-emacs # ----------------------------------------------------------------------------- solar-valgrind: $(elc) $(so) $(mcmd) --makefile ../Makefile valgrind $(vg_opts) emacs $(emacs_run_opts) $(solar-debug) -l $< -f sdl2-solar -f kill-emacs $(mcmd) log solar-asan: $(elc) $(so) echo "DNC" $(mcmd) --makefile ../Makefile export ASAN_OPTIONS=verify_asan_link_order=0 export ASAN_OPITONS=identify_leaks=1 export LD_PRELOAD=$(gcc -print-file-name libasan.so) emacs $(emacs_dbg_opts) -l $< -f sdl2-solar -f kill-emacs solar-heaptrack: $(elc) $(so) echo "DNC" $(mcmd) --makefile ../Makefile heaptrack emacs $(emacs_dbg_opts) -l $< -f sdl2-solar -f kill-emacs