# to print the debug messages to syslog)
DEBUG = false
+# compile with gcc's code coverage option
+# (use it with DEBUG, works only with glibc)
+USE_GCOV = false
+
# include Security-Enhanced Linux support
USE_SELINUX = false
STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
endif
+ifeq ($(strip $(USE_GCOV)),true)
+ CFLAGS += -fprofile-arcs -ftest-coverage
+ LDFLAGS = -fprofile-arcs
+endif
+
# if our own version of klibc is used, we need to build it
ifeq ($(strip $(USE_KLIBC)),true)
KLIBC_INSTALL = $(PWD)/klibc/.install
LD = $(KLCC)
else
CFLAGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
+ LDFLAGS += -Wl,-warn-common
endif
ifeq ($(strip $(USE_SELINUX)),true)
-C $$target $@; \
done;
.PHONY: all
+.DEFAULT: all
# clear implicit rules
.SUFFIXES:
.SILENT: ccdv
clean:
- -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print | xargs rm -f
- -rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS)
+ - find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print0 | xargs -0rt rm -f
+ - find -name "*.gcno" -print0 | xargs -0rt rm -f
+ - find -name "*.gcda" -print0 | xargs -0rt rm -f
+ - find -name "*.gcov" -print0 | xargs -0rt rm -f
+ - rm -f udev_gcov.txt
+ - rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS)
$(MAKE) -C klibc SUBDIRS=klibc clean
@extras="$(EXTRAS)"; for target in $$extras; do \
echo $$target; \
- rm $(mandir)/man8/udevcontrol.8
.PHONY: uninstall-man
-install: install-config install-man all
+install-bin:
$(INSTALL) -d $(DESTDIR)$(udevdir)
$(INSTALL_PROGRAM) -D udev $(DESTDIR)$(sbindir)/udev
$(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd
echo $$target; \
$(MAKE) prefix=$(prefix) -C $$target $@; \
done;
-.PHONY: install
+.PHONY: install-bin
-uninstall: uninstall-man
- - rm $(configdir)/rules.d/50-udev.rules
- - rm $(configdir)/udev.conf
- - rmdir $(configdir)/rules.d
- - rmdir $(configdir)
+uninstall-bin:
- rm $(sbindir)/udev
- rm $(sbindir)/udevd
- rm $(sbindir)/udevsend
- rm $(usrbindir)/udevinfo
- rm $(usrbindir)/udevtest
- rm -rf $(udevdb)
- - rmdir $(udevdir)
- killall udevd
@extras="$(EXTRAS)"; for target in $$extras; do \
echo $$target; \
$(MAKE) prefix=$(prefix) -C $$target $@; \
done;
-.PHONY: uninstall-man
+.PHONY: uninstall-bin
+
+install: all install-bin install-config install-man
+.PHONY: install
+
+uninstall: uninstall-bin uninstall-man
+.PHONY: uninstall
test tests: all
@ cd test && ./udev-test.pl
@ cd test && ./udevstart-test.pl
.PHONY: test tests
+buildtest:
+ ./test/simple-build-check.sh
+.PHONY: buildtest
+
+gcov-all:
+ $(MAKE) clean all DEBUG=true USE_GCOV=true
+ @echo
+ @echo "binaries built with gcov support."
+ @echo "run the tests and analyze with 'make udev_gcov.txt'"
+.PHONY: gcov-all
+
+# see docs/README-gcov_for_udev
+udev_gcov.txt: $(wildcard *.gcda) $(wildcard *.gcno)
+ for file in `find -maxdepth 1 -name "*.gcno"`; do \
+ name=`basename $$file .gcno`; \
+ echo "################" >> $@; \
+ echo "$$name.c" >> $@; \
+ echo "################" >> $@; \
+ if [ -e "$$name.gcda" ]; then \
+ gcov -l "$$name.c" >> $@ 2>&1; \
+ else \
+ echo "code for $$name.c was never executed" >> $@ 2>&1; \
+ fi; \
+ echo >> $@; \
+ done; \
+ echo "view $@ for the result"
+