Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. include ../make.inc
  2. CFLAGS += $(BASE_CFLAGS) $(WARN_CFLAGS)
  3. LDFLAGS ?=
  4. LIBS ?= -lrt -lm
  5. BIN := pwrtray-backend
  6. # Battery modules. battery_dummy.c must be last.
  7. BAT_MODULES := \
  8. battery_powerbook.c \
  9. battery_n810.c \
  10. battery_class.c \
  11. battery_acpi.c \
  12. battery_dummy.c
  13. # Backlight modules. backlight_dummy.c must be last.
  14. BL_MODULES := \
  15. backlight_omapfb.c \
  16. backlight_class.c \
  17. backlight_dummy.c
  18. # Device lock modules. devicelock_dummy.c must be last.
  19. DLOCK_MODULES := \
  20. devicelock_n810.c \
  21. devicelock_dummy.c
  22. SRCS := main.c timer.c log.c args.c conf.c util.c fileaccess.c \
  23. autodim.c x11lock.c xevrep.c probe.c \
  24. battery.c $(BAT_MODULES) \
  25. backlight.c $(BL_MODULES) \
  26. devicelock.c $(DLOCK_MODULES)
  27. V = @ # Verbose build: make V=1
  28. Q = $(V:1=)
  29. QUIET_CC = $(Q:@=@echo ' CC '$@;)$(CC)
  30. QUIET_DEPEND = $(Q:@=@echo ' DEPEND '$@;)$(CC)
  31. DEPS = $(patsubst %.c,dep/%.d,$(1))
  32. OBJS = $(patsubst %.c,obj/%.o,$(1))
  33. .SUFFIXES:
  34. .PHONY: all install clean
  35. .DEFAULT_GOAL := all
  36. # Generate dependencies
  37. $(call DEPS,$(SRCS)): dep/%.d: %.c
  38. @mkdir -p $(dir $@)
  39. $(QUIET_DEPEND) -o $@.tmp -MM -MT "$@ $(patsubst dep/%.d,obj/%.o,$@)" $(CFLAGS) $< && mv -f $@.tmp $@
  40. -include $(call DEPS,$(SRCS))
  41. # Generate object files
  42. $(call OBJS,$(SRCS)): obj/%.o:
  43. @mkdir -p $(dir $@)
  44. $(QUIET_CC) -o $@ -c $(CFLAGS) $<
  45. all: $(BIN)
  46. $(BIN): $(call OBJS,$(SRCS))
  47. $(QUIET_CC) $(CFLAGS) -o $(BIN) $(LDFLAGS) $(LIBS) $(call OBJS,$(SRCS))
  48. clean:
  49. rm -Rf dep obj core *~ $(BIN)
  50. install: $(BIN)
  51. $(INSTALL) -d -m755 $(DESTDIR)$(PREFIX)/bin/
  52. $(INSTALL) -m755 $(BIN) $(DESTDIR)$(PREFIX)/bin/