summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile102
1 files changed, 50 insertions, 52 deletions
diff --git a/Makefile b/Makefile
index db8ecdacc6..f650233cee 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ USE_STATIC = false
EXTRAS =
# make the build silent.
-V = false
+V =
PROGRAMS = \
udev \
@@ -148,7 +148,6 @@ ifeq ($(strip $(USE_KLIBC)),true)
KLCC = /usr/bin/$(CROSS_COMPILE)klcc
CC = $(KLCC)
LD = $(KLCC)
- V = true
endif
ifeq ($(strip $(USE_SELINUX)),true)
@@ -162,17 +161,17 @@ ifeq ($(strip $(USE_STATIC)),true)
LDFLAGS += -static
endif
-ifeq ($(strip $(V)),false)
- QUIET=@$(PWD)/ccdv
- HOST_PROGS=ccdv
+ifeq ($(strip $(V)),)
+ E = @echo
+ Q = @
else
- QUIET=
- HOST_PROGS=
+ E = @\#
+ Q =
endif
+export E Q
all: $(PROGRAMS) $(MAN_PAGES)
- @extras="$(EXTRAS)"; for target in $$extras; do \
- echo $$target; \
+ $(Q) extras="$(EXTRAS)"; for target in $$extras; do \
$(MAKE) CC="$(CC)" \
CFLAGS="$(CFLAGS)" \
LD="$(LD)" \
@@ -180,7 +179,6 @@ all: $(PROGRAMS) $(MAN_PAGES)
STRIPCMD="$(STRIPCMD)" \
LIB_OBJS="$(LIB_OBJS)" \
LIBUDEV="$(PWD)/$(LIBUDEV)" \
- QUIET="$(QUIET)" \
-C $$target $@ || exit 1; \
done;
.PHONY: all
@@ -190,49 +188,54 @@ all: $(PROGRAMS) $(MAN_PAGES)
.SUFFIXES:
# build the objects
-%.o: %.c $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS)
- $(QUIET) $(CC) -c $(CFLAGS) $< -o $@
+%.o: %.c $(HEADERS) $(GEN_HEADERS)
+ $(E) " CC " $@
+ $(Q) $(CC) -c $(CFLAGS) $< -o $@
# "Static Pattern Rule" to build all programs
-$(PROGRAMS): %: $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(LIBUDEV) %.o
- $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIB_OBJS)
+$(PROGRAMS): %: $(HEADERS) $(GEN_HEADERS) $(LIBUDEV) %.o
+ $(E) " LD " $@
+ $(Q) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIB_OBJS)
ifneq ($(STRIPCMD),)
- $(QUIET) $(STRIPCMD) $@
+ $(E) " STRIP " $@
+ $(Q) $(STRIPCMD) $@
endif
-$(LIBUDEV): $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS)
- @rm -f $@
- $(QUIET) $(AR) cq $@ $(UDEV_OBJS)
- $(QUIET) $(RANLIB) $@
+$(LIBUDEV): $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS)
+ $(Q) rm -f $@
+ $(E) " AR " $@
+ $(Q) $(AR) cq $@ $(UDEV_OBJS)
+ $(E) " RANLIB " $@
+ $(Q) $(RANLIB) $@
udev_version.h:
- @echo "/* Generated by make. */" > $@
- @echo \#define UDEV_VERSION \"$(VERSION)\" >> $@
- @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@
- @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@
- @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@
+ $(E) " GENHDR " $@
+ $(Q) echo "/* Generated by make. */" > $@
+ $(Q) echo \#define UDEV_VERSION \"$(VERSION)\" >> $@
+ $(Q) echo \#define UDEV_ROOT \"$(udevdir)\" >> $@
+ $(Q) echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@
+ $(Q) echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@
# man pages
%.8 %.7: docs/%.xml
- xmlto man $?
+ $(E) " XMLTO " $@
+ $(Q) xmlto man $?
.PRECIOUS: %.8
-ccdv: ccdv.c
- @$(HOSTCC) -O1 ccdv.c -o ccdv
-.SILENT: ccdv
-
clean:
- - rm -f $(HOST_PROGS)
- - 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)
- - rm -f udev-$(VERSION).tar.gz
- - rm -f udev-$(VERSION).tar.bz2
- @extras="$(EXTRAS)"; for target in $$extras; do \
- echo $$target; \
+ $(E) " CLEAN "
+ $(Q) - find . -type f -name '*.orig' -print0 | xargs -0r rm -f
+ $(Q) - find . -type f -name '*.rej' -print0 | xargs -0r rm -f
+ $(Q) - find . -type f -name '*~' -print0 | xargs -0r rm -f
+ $(Q) - find . -type f -name '*.[oas]' -print0 | xargs -0r rm -f
+ $(Q) - find . -type f -name "*.gcno" -print0 | xargs -0r rm -f
+ $(Q) - find . -type f -name "*.gcda" -print0 | xargs -0r rm -f
+ $(Q) - find . -type f -name "*.gcov" -print0 | xargs -0r rm -f
+ $(Q) - rm -f udev_gcov.txt
+ $(Q) - rm -f core $(PROGRAMS) $(GEN_HEADERS)
+ $(Q) - rm -f udev-$(VERSION).tar.gz
+ $(Q) - rm -f udev-$(VERSION).tar.bz2
+ @ extras="$(EXTRAS)"; for target in $$extras; do \
$(MAKE) -C $$target $@ || exit 1; \
done;
.PHONY: clean
@@ -244,16 +247,15 @@ release:
install-config:
$(INSTALL) -d $(DESTDIR)$(configdir)/rules.d
- @if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \
+ @ if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \
$(INSTALL_DATA) etc/udev/udev.conf $(DESTDIR)$(configdir); \
fi
- @if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \
+ @ if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \
echo; \
echo "pick a udev rules file from the etc/udev directory that matches your distribution"; \
echo; \
fi
- @extras="$(EXTRAS)"; for target in $$extras; do \
- echo $$target; \
+ @ extras="$(EXTRAS)"; for target in $$extras; do \
$(MAKE) -C $$target $@ || exit 1; \
done;
.PHONY: install-config
@@ -266,7 +268,6 @@ install-man:
$(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8
- ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8
@extras="$(EXTRAS)"; for target in $$extras; do \
- echo $$target; \
$(MAKE) -C $$target $@ || exit 1; \
done;
.PHONY: install-man
@@ -278,8 +279,7 @@ uninstall-man:
- rm -f $(DESTDIR)$(mandir)/man8/udevd.8
- rm -f $(DESTDIR)$(mandir)/man8/udevmonitor.8
- rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8
- @extras="$(EXTRAS)"; for target in $$extras; do \
- echo $$target; \
+ @ extras="$(EXTRAS)"; for target in $$extras; do \
$(MAKE) -C $$target $@ || exit 1; \
done;
.PHONY: uninstall-man
@@ -292,7 +292,6 @@ install-bin:
$(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo
$(INSTALL_PROGRAM) -D udevtest $(DESTDIR)$(usrbindir)/udevtest
@extras="$(EXTRAS)"; for target in $$extras; do \
- echo $$target; \
$(MAKE) -C $$target $@ || exit 1; \
done;
ifndef DESTDIR
@@ -313,7 +312,6 @@ ifndef DESTDIR
- rm -rf /dev/.udev
endif
@extras="$(EXTRAS)"; for target in $$extras; do \
- echo $$target; \
$(MAKE) -C $$target $@ || exit 1; \
done;
.PHONY: uninstall-bin
@@ -346,9 +344,9 @@ ChangeLog: Makefile
gcov-all:
$(MAKE) clean all STRIPCMD= USE_GCOV=true
- @echo
- @echo "binaries built with gcov support."
- @echo "run the tests and analyze with 'make udev_gcov.txt'"
+ @ 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