This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zhangyang-variable-monitor/Makefile
2023-12-05 22:36:27 -05:00

43 lines
1.0 KiB
Makefile

CC := gcc
CFLAGS := -Wall
SPID = stack-pid
TOOLDIR := $(PWD)/tools
TDIR := $(PWD)/testcase
PROGRAMS := helloworld hptest userstack
USTACK = userstack
UDIR = $(PWD)/source/uapi
MDIR := $(PWD)/source
KDIR := /usr/src/kernels/5.17.15-1.el8.x86_64/ # 内核源码目录
BUILD_DIR := $(PWD)/build
OUTPUT_DIR = $(PWD)/build
all: $(addprefix $(OUTPUT_DIR)/, $(PROGRAMS)) module ucli $(SPID)
# Pattern rule for helloworld and HPTEST
$(OUTPUT_DIR)/%: $(TDIR)/%.c
mkdir -p $(@D)
$(CC) $(CFLAGS) -o $@ $< $(UDIR)/monitor_user.c
# Specific rule for USTACK
$(OUTPUT_DIR)/$(USTACK): $(TDIR)/$(USTACK).c
mkdir -p $(@D)
# $(CC) -g $(CFLAGS) -o $@ $< -lunwind -lunwind-x86_64
$(CC) -g -O2 $(CFLAGS) -o $@ $< -lpthread
$(SPID): $(TOOLDIR)/stack-pid.c
$(CC) $(CFLAGS) -o $(OUTPUT_DIR)/$(SPID) $(TOOLDIR)/stack-pid.c -lunwind -lunwind-x86_64 -lunwind-ptrace
ucli:
$(MAKE) -C $(PWD)/source/ucli OUTPUT_DIR=$(OUTPUT_DIR)
module:
make -C $(KDIR) M=$(MDIR) modules
clean:
rm -f $(OUTPUT_DIR)/*
make -C $(KDIR) M=$(MDIR) clean
make -C $(PWD)/source/ucli clean