# this file: https://dataswamp.org/~incal/bad-el/src/bad-sdl3/Makefile mkef = -j -s mcmd = $(MAKE) $(mkef) name = bad-sdl3 el = $(name).el elc = $(name).elc obj = $(name).o src = $(name).c so = $(name).so log = $(name).log sdld = /usr/include sdlf = -D_REENTRANT -I /$(sdld)/libdrm -I $(sdld)/libdecor-0 -I $(sdld)/pipewire-0.3 -I $(sdld)/spa-0.2 sdll = -lSDL3 -lSDL3_image -lSDL3_ttf warn = -pedantic-errors -Wall -Wextra ccfl = -D_NDEBUG -fPIC --shared --std=c11 $(warn) $(sdlf) comp = gcc $(ccfl) libs = -lssl -lcrypto $(sdll) # ----------------------------------------------------------------------------- all: $(elc) $(so) $(so): $(obj) $(comp) -o $@ $^ $(libs) %.o: %.c $(comp) -c $< -o $@ # ----------------------------------------------------------------------------- filter = 2>&1 | sed '/^\(Gtk|Loading\|\older|Wrote\)/d' quiet = 1> /dev/null 2> /dev/null $(elc): $(el) emacs --batch -L ".." -f batch-byte-compile $< $(filter) emacs --batch -L ".." -f batch-native-compile $< $(filter) # ----------------------------------------------------------------------------- clean: rm -f $(elc) $(obj) $(so) $(log) clear: $(mcmd) clean again: $(mcmd) clean $(mcmd) # ----------------------------------------------------------------------------- emacs_run_opts = -q -D emacs_dbg_opts = $(emacs_run_opts) --module-assertions --eval "(setq debug-on-error t)" --eval "(setq debug-on-signal t)" --eval "(setq debug-on-quit t)" # ----------------------------------------------------------------------------- log: touch $(log) grep $(so) $(log) | sort -u ps_opts = --no-headers -T -p meta: echo -n "threads: " ps $(ps_opts) `pidof emacs` | wc -l ps $(ps_opts) `pidof emacs` # ----------------------------------------------------------------------------- fps: $(elc) $(so) $(mcmd) --makefile ../Makefile clear emacs $(emacs_run_opts) -l $< -f sdl3-fps -f kill-emacs 2> /dev/null fps-gdb: $(elc) $(so) $(mcmd) --makefile ../Makefile gdb --args emacs $(emacs_run_opts) -l $< -f sdl3-fps -f kill-emacs # ----------------------------------------------------------------------------- solar: $(elc) $(so) $(mcmd) --makefile ../Makefile clear emacs $(emacs_run_opts) -l $< -f sdl3-solar -f kill-emacs 2> /dev/null solar-gdb: $(elc) $(so) $(mcmd) --makefile ../Makefile gdb --args emacs $(emacs_run_opts) -l $< -f sdl3-solar -f kill-emacs # ----------------------------------------------------------------------------- kill: pkill -9 gmake kill -9 $(pidof gmake) pkill -9 sdl3-cache kill -9 $(pidof sdl3-cache) kill -9 sdl3-surface kill -9 $(pidof sdl3-surface) ccc: $(el) $(name).h cppcheck $(name).c \ --enable=all \ --language=c \ --platform=unix64 \ --std=c11 \ --include=$(name).h