summaryrefslogtreecommitdiffstats
path: root/runtime/uprobes/Makefile
blob: 4e1280ef5d4933807126493612a69ae0eb56b79b (plain)
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
42
43
44
45
46
47
48
49
50
51
obj-m := uprobes.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
DEPENDENCIES := $(shell echo uprobes.[ch] uprobes_*.[ch])
DEPENDENCIES += $(shell echo ../uprobes2/uprobes.[ch] ../uprobes2/uprobes_*.[ch])
DEPENDENCIES += Makefile

CLEAN_FILES := $(shell echo *.mod.c *.ko *.o .*.cmd *~ *.sgn)
CLEAN_FILES += Module.markers modules.order Module.symvers
CLEAN_DIRS  := .tmp_versions

# Build the module and sign it.
# Ensure that the generated files are writeable by the group which
# owns this build directory. This is so that the stap-server service
# can rebuild the module, if necessary.
default:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
	if test -f ../../../../bin/stap-sign-module; then \
		for f in *.ko; do \
			if test ! -e $$f.sgn -o $$f.sgn -ot $$f; then \
				../../../../bin/stap-sign-module $$f; \
			fi \
		done \
	fi
	group=`stat -c %G $(PWD)`; \
	for f in $(CLEAN_FILES); do \
		test ! -f $$f && continue; \
		chgrp -f $$group $$f; \
		chmod -f 664 $$f; \
	done; \
	for d in $(CLEAN_DIRS); do \
		test ! -d $$d && continue; \
		chgrp -f $$group $$d; \
		chmod -f 775 $$d; \
		for dd in `find $$d -type d`; do \
			chgrp -f $$group $$dd; \
			chmod -f 775 $$dd; \
		done; \
		for f in `find $$d -type f`; do \
			chgrp -f $$group $$f; \
			chmod -f 664 $$f; \
		done; \
	done

# This target is used with "make -q" to see whether a "real" build is needed.
uprobes.ko: $(DEPENDENCIES)
	@echo uprobes.ko is not a valid target.  See Makefile.

clean:
	rm -f $(CLEAN_FILES)
	rm -rf $(CLEAN_DIRS)