2023-08-20 15:00:51 +02:00
|
|
|
ifndef _MK_LIBWRAP
|
|
|
|
_MK_LIBWRAP := # defined
|
2020-06-18 12:15:52 +02:00
|
|
|
|
|
|
|
LIBWRAP_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
|
|
|
LIBWRAP_DIR := $(LIBWRAP_DIR:/=)
|
|
|
|
|
|
|
|
LIBWRAP_SRCS := \
|
|
|
|
stdlib/malloc.c \
|
|
|
|
sys/open.c \
|
|
|
|
sys/lseek.c \
|
|
|
|
sys/read.c \
|
|
|
|
sys/write.c \
|
|
|
|
sys/fstat.c \
|
|
|
|
sys/stat.c \
|
|
|
|
sys/close.c \
|
|
|
|
sys/link.c \
|
|
|
|
sys/unlink.c \
|
|
|
|
sys/execve.c \
|
|
|
|
sys/fork.c \
|
|
|
|
sys/getpid.c \
|
|
|
|
sys/kill.c \
|
|
|
|
sys/wait.c \
|
|
|
|
sys/isatty.c \
|
|
|
|
sys/times.c \
|
|
|
|
sys/sbrk.c \
|
2023-08-20 15:00:51 +02:00
|
|
|
sys/_exit.c \
|
2023-09-28 11:51:20 +02:00
|
|
|
sys/puts.c \
|
2023-08-20 15:00:51 +02:00
|
|
|
misc/write_hex.c \
|
|
|
|
sys/printf.c
|
2020-06-18 12:15:52 +02:00
|
|
|
|
|
|
|
LIBWRAP_SRCS := $(foreach f,$(LIBWRAP_SRCS),$(LIBWRAP_DIR)/$(f))
|
|
|
|
LIBWRAP_OBJS := $(LIBWRAP_SRCS:.c=.o)
|
|
|
|
|
2023-09-28 11:51:20 +02:00
|
|
|
LIBWRAP_SYMS := \
|
|
|
|
open \
|
|
|
|
lseek _lseek\
|
|
|
|
read _read\
|
|
|
|
write _write\
|
|
|
|
fstat _fstat\
|
|
|
|
stat \
|
|
|
|
close _close\
|
|
|
|
link \
|
|
|
|
unlink \
|
|
|
|
execve \
|
|
|
|
fork \
|
|
|
|
getpid \
|
|
|
|
kill \
|
|
|
|
wait \
|
|
|
|
isatty \
|
|
|
|
times \
|
|
|
|
sbrk _sbrk\
|
|
|
|
_exit \
|
|
|
|
puts _puts\
|
|
|
|
printf \
|
|
|
|
sprintf
|
2020-06-18 12:15:52 +02:00
|
|
|
|
|
|
|
LIBWRAP := libwrap.a
|
|
|
|
|
|
|
|
LINK_DEPS += $(LIBWRAP)
|
|
|
|
|
|
|
|
LDFLAGS += $(foreach s,$(LIBWRAP_SYMS),-Wl,--wrap=$(s))
|
|
|
|
LDFLAGS += -L. -Wl,--start-group -lwrap -lc -Wl,--end-group
|
|
|
|
|
|
|
|
CLEAN_OBJS += $(LIBWRAP_OBJS)
|
|
|
|
|
|
|
|
$(LIBWRAP_OBJS): %.o: %.c $(HEADERS)
|
|
|
|
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
|
|
|
|
|
|
|
|
$(LIBWRAP): $(LIBWRAP_OBJS)
|
|
|
|
$(AR) rcs $@ $^
|
|
|
|
|
2023-08-20 15:00:51 +02:00
|
|
|
endif # _MK_LIBWRAP
|