makefile-incl.gudev 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # Custom systemd Makefile include that builds/installs gudev only for LFS
  2. # vim: tabstop=3
  3. LIBGUDEV_SRCS = \
  4. gudevclient.c \
  5. gudevdevice.c \
  6. gudevenumerator.c \
  7. gudevenumtypes.c \
  8. gudevmarshal.c
  9. LIBGUDEV_INCLUDES = \
  10. src/gudev/gudev.h \
  11. src/gudev/gudevenums.h \
  12. src/gudev/gudevenumtypes.h \
  13. src/gudev/gudevtypes.h \
  14. src/gudev/gudevclient.h \
  15. src/gudev/gudevdevice.h \
  16. src/gudev/gudevenumerator.h
  17. LIBGUDEV_OBJS := $(addprefix build/, $(LIBGUDEV_SRCS:.c=.o))
  18. LIBGUDEV_CFLAGS = \
  19. -I src/gudev \
  20. -D_POSIX_PTHREAD_SEMANTICS \
  21. -D_REENTRANT \
  22. -D_GUDEV_COMPILATION \
  23. -DG_LOG_DOMAIN=\"GUdev\" \
  24. -fvisibility=default \
  25. -I /usr/include/glib-2.0 \
  26. -I /usr/lib/glib-2.0/include
  27. LIBGUDEV_LDFLAGS = \
  28. -L build -L /usr/lib \
  29. -ludev -lgobject-2.0 \
  30. -lglib-2.0
  31. GUDEV_GENERATED = \
  32. src/gudev/gudevmarshal.h \
  33. src/gudev/gudevmarshal.c \
  34. src/gudev/gudevenumtypes.h \
  35. src/gudev/gudevenumtypes.c
  36. LIBGUDEV = libgudev-1.0
  37. LIBGUDEV_MAJOR = .0
  38. LIBGUDEV_MINOR = .1
  39. LIBGUDEV_PATCH = .2
  40. LIBGUDEV_SONAME := $(LIBGUDEV).so
  41. LIBGUDEV_LINK_NAME := $(LIBGUDEV_SONAME)$(LIBGUDEV_MAJOR)
  42. LIBGUDEV_REAL_NAME := $(LIBGUDEV_LINK_NAME)$(LIBGUDEV_MINOR)$(LIBGUDEV_PATCH)
  43. src/gudev/gudevmarshal.h: src/gudev/gudevmarshal.list
  44. @echo GEN $@
  45. $(VB)glib-genmarshal $< --prefix=g_udev_marshal --header > $@
  46. src/gudev/gudevmarshal.c: src/gudev/gudevmarshal.list
  47. @echo GEN $@
  48. @echo "#include \"gudevmarshal.h\"" > $@
  49. $(VB)glib-genmarshal $< --prefix=g_udev_marshal --body >> $@
  50. src/gudev/gudevenumtypes.h: src/gudev/gudevenumtypes.h.template src/gudev/gudevenums.h
  51. @echo GEN $@
  52. $(VB)glib-mkenums --template $^ > $@
  53. src/gudev/gudevenumtypes.c: src/gudev/gudevenumtypes.c.template src/gudev/gudevenums.h
  54. @echo GEN $@
  55. $(VB)glib-mkenums --template $^ > $@
  56. build/%o: src/gudev/%c $(GUDEV_GENERATED) common
  57. @echo CC $<
  58. $(VB)gcc -c $(LIBGUDEV_CFLAGS) $(WARN) $(OPTIONS) $(INCLUDE) $(DEF) -o $@ $<
  59. build/$(LIBGUDEV_REAL_NAME): $(LIBGUDEV_OBJS) build/udev-local.a build/$(LIBUDEV_REAL_NAME)
  60. @echo LINK $@
  61. $(VB)gcc -shared -Wl,--export-dynamic -Wl,-soname,$(LIBGUDEV_LINK_NAME) \
  62. -o build/$(LIBGUDEV_REAL_NAME) $(LIBGUDEV_OBJS) $(LIBGUDEV_LDFLAGS)
  63. ln -sfn $(LIBGUDEV_REAL_NAME) build/$(LIBGUDEV_LINK_NAME)
  64. ln -sfn $(LIBGUDEV_REAL_NAME) build/$(LIBGUDEV_SONAME)
  65. build/gudev-1.0.pc: src/gudev/gudev-1.0.pc.in common
  66. @echo GEN $@
  67. @$(SED_PROCESS)
  68. gudev: build/$(LIBGUDEV_REAL_NAME) build/gudev-1.0.pc
  69. clean-gudev:
  70. rm -f src/gudev/gudevmarshal.h
  71. rm -f src/gudev/gudevmarshal.c
  72. rm -f src/gudev/gudevenumtypes.h
  73. rm -f src/gudev/gudevenumtypes.c
  74. rm -f $(LIBGUDEV_OBJS)
  75. rm -f build/libgudev-1.0.so*
  76. install-gudev: gudev
  77. @mkdir -pv $(DESTDIR)/usr/include/gudev-1.0/gudev \
  78. $(DESTDIR)/usr/lib/pkgconfig \
  79. $(DESTDIR)/usr/share/gtk-doc/html/gudev
  80. @cp -v $(LIBGUDEV_INCLUDES) $(DESTDIR)/usr/include/gudev-1.0/gudev
  81. @cp -v build/$(LIBGUDEV_REAL_NAME) $(DESTDIR)/usr/lib
  82. @ln -svfn $(LIBGUDEV_REAL_NAME) $(DESTDIR)/usr/lib/$(LIBGUDEV_SONAME)
  83. @ln -svfn $(LIBGUDEV_REAL_NAME) $(DESTDIR)/usr/lib/$(LIBGUDEV_LINK_NAME)
  84. @cp -v build/gudev-1.0.pc $(DESTDIR)/usr/lib/pkgconfig
  85. @cp -v docs/gudev/html/* $(DESTDIR)/usr/share/gtk-doc/html/gudev