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

40 lines
986 B
Makefile
Raw Normal View History

2023-11-27 02:56:12 -05:00
CC := gcc
CFLAGS := -Wall
2023-11-16 13:17:49 +08:00
2023-11-27 02:56:12 -05:00
TDIR := $(PWD)/testcase
PROGRAMS := helloworld hptest userstack
2023-11-21 20:51:29 -05:00
USTACK = userstack
2023-11-16 13:17:49 +08:00
2023-11-16 14:07:26 +08:00
UDIR = $(PWD)/source/uapi
2023-11-16 06:02:17 -05:00
MDIR := $(PWD)/source
KDIR := /usr/src/kernels/5.17.15-1.el8.x86_64/ # 内核源码目录
2023-11-16 13:17:49 +08:00
BUILD_DIR := $(PWD)/build
OUTPUT_DIR = $(PWD)/build
2023-11-27 02:56:12 -05:00
all: $(addprefix $(OUTPUT_DIR)/, $(PROGRAMS)) module ucli
2023-11-16 13:17:49 +08:00
2023-11-27 02:56:12 -05:00
# Pattern rule for helloworld and HPTEST
$(OUTPUT_DIR)/%: $(TDIR)/%.c
mkdir -p $(@D)
$(CC) $(CFLAGS) -o $@ $< $(UDIR)/monitor_user.c
2023-11-16 13:17:49 +08:00
2023-11-27 02:56:12 -05:00
# Specific rule for USTACK
$(OUTPUT_DIR)/$(USTACK): $(TDIR)/$(USTACK).c
mkdir -p $(@D)
$(CC) -g $(CFLAGS) -o $@ $< -lunwind -lunwind-x86_64
2023-11-16 13:17:49 +08:00
2023-11-27 02:56:12 -05:00
# $(SPID): $(TDIR)/stack-pid.c
# mkdir -p $(OUTPUT_DIR)
# $(CC) $(CFLAGS) -o $(OUTPUT_DIR)/$(SPID) $(TDIR)/stack-pid.c -lunwind -lunwind-x86_64 -lunwind-ptrace
2023-11-16 13:17:49 +08:00
2023-11-27 02:56:12 -05:00
ucli:
$(MAKE) -C $(PWD)/source/ucli OUTPUT_DIR=$(OUTPUT_DIR)
2023-11-21 20:51:29 -05:00
2023-11-16 13:17:49 +08:00
module:
make -C $(KDIR) M=$(MDIR) modules
clean:
rm -f $(OUTPUT_DIR)/*
2023-11-27 02:58:17 -05:00
make -C $(KDIR) M=$(MDIR) clean
make -C $(PWD)/source/ucli clean