execve_hook/Makefile

33 lines
789 B
Makefile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CC = gcc
CFLAGS = -shared -fPIC -Wall -Wextra -Werror -O2 -fno-strict-aliasing -fPIC -fno-omit-frame-pointer -fno-stack-protector -Wl,-z,relro,-z,now
LDFLAGS = -ldl -ljson-c
TARGET_NAME = intercept.so
BUILD_DIR = build
SRC_DIR = src
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SRC))
TARGET = $(BUILD_DIR)/$(TARGET_NAME)
# 如果需要开启 debug只需执行 make DEBUG=1
ifeq ($(DEBUG),1)
CFLAGS += -DDEBUG -g # Add -g for debugging symbols
endif
all: $(TARGET)
$(BUILD_DIR)/$(TARGET_NAME): $(OBJ)
@mkdir -p $(BUILD_DIR)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(BUILD_DIR)
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(BUILD_DIR)
debug:
rm -rf $(BUILD_DIR)
$(MAKE) DEBUG=1
rebuild: clean all