-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (28 loc) · 892 Bytes
/
Makefile
File metadata and controls
41 lines (28 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CC := gcc
APP_ENTRY := kernel_porting_test_cases
APP_ENTRY_FLAGS := main.c -I. -DAPP_ENTRY=$(APP_ENTRY) -e $(APP_ENTRY) -nostartfiles
C_SRCS := $(shell find ./ ! -name "main.c" -a -name "*.c" )
C_OBJS := $(patsubst %.c,%.o,$(C_SRCS))
OBJS := $(C_OBJS)
LDFLAG := -Wall -g -pthread -lrt -ldl -L. -lkp
CFLAG_OBJS := -Wall -Werror -I. -g -fPIC -Wno-error=unused-function
TARGET := test
TARGET_LIB := libkp.a
TARGET_SO := libkp.so
.PHONY: all
all: $(TARGET_LIB) $(TARGET_SO) $(TARGET)
$(TARGET_LIB):$(OBJS)
$(AR) -r $@ $(OBJS)
$(TARGET_SO):$(OBJS)
$(CC) $(OBJS) -shared -o $@
$(TARGET):
$(CC) -o $@ $(APP_ENTRY_FLAGS) $(LDFLAG)
$(C_OBJS):%.o:%.c
$(CC) $(CFLAG_OBJS) -c $< -o $@
.PHONY: clean
clean:
rm -f $(OBJS) $(TARGET) $(TARGET_SO) $(TARGET_LIB)
.PHONY: distclean
distclean:clean
rm -rf cscope.*
rm -rf tags