43 lines
907 B
Makefile
43 lines
907 B
Makefile
|
|
CC=gcc
|
|
CFLAGS=-std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809L -g
|
|
|
|
.PHONY: all clean
|
|
all: default
|
|
default: bin main
|
|
|
|
bin:
|
|
mkdir -p bin/
|
|
|
|
bin/main.o: src/main.c
|
|
$(CC) -c -o $@ $^ $(CFLAGS)
|
|
|
|
test_kernel.ko: src/test_kernel.c
|
|
$(CC) -D__KERNEL__ -DMODULE -I/usr/src/linux/include -o $@ $^
|
|
|
|
main: bin/main.o
|
|
$(CC) -o $@ $^ $(CFLAGS) -lc -lpthread
|
|
|
|
clean:
|
|
rm -rf main bin/* *.so *.ko *.o
|
|
|
|
|
|
#ifneq ($(KERNELRELEASE),)
|
|
# # call from kernel build system
|
|
# lifo-objs := main.o
|
|
# obj-m := lifo.o
|
|
#else
|
|
# KERNELDIR ?= /lib/modules/$(shell uname -r)/build
|
|
# PWD := $(shell pwd)
|
|
#modules:
|
|
# echo $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../include modules
|
|
# $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../include modules
|
|
#endif
|
|
#
|
|
#depend .depend dep:
|
|
# $(CC) $(CFLAGS) -M *.c > .depend
|
|
#
|
|
#ifeq (.depend,$(wildcard .depend))
|
|
# include .depend
|
|
#endif
|