12345678910111213141516171819202122232425262728293031323334353637383940 |
- INCLUDE_PATH ?= ./include
- INCLUDE_FASMG ?= ${INCLUDE_PATH}/fasmg
- INCLUDE_COMMON ?= ${INCLUDE_PATH}/common
- INCLUDE := ${INCLUDE_FASMG};${INCLUDE_COMMON}
- FANCY_SYSCALL ?= | sort -nk 3 | column -t
- SYSCALL_INC ?= ${INCLUDE_COMMON}/syscall.inc
- rwildcard = $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2) \
- $(filter $(subst *,%,$2),$d))
- FASMG ?= fasmg
- .PHONY: all
- all: pd
- ${SYSCALL_INC}:
- mkdir -p '$(dir $@)'
- { echo '; vim: ft=fasm:' \
- ; echo 'if ~ definite syscall' \
- ; echo 'namespace syscall' \
- ; echo '#include <sys/syscall.h>' \
- | cpp -dM \
- | sed -n 's/^#define\s\(SYS_[^ ]\+\) \([0-9]\+\)$$/\1 equ \2/p' \
- ${FANCY_SYSCALL} \
- ; echo 'end namespace' \
- ; echo 'end if' \
- ; } > $@
-
- export INCLUDE
- %: %.asm $(call rwildcard,./include,*.inc)
- ${FASMG} $< $@
- chmod +x $@
- .PHONY: clean
- clean:
- rm -f pd
|