Patrick Williams | 3667cf3 | 2015-10-20 22:39:11 -0500 | [diff] [blame^] | 1 | LIBS += libphosphor-hwmon.so |
| 2 | libphosphor-hwmon.so_OBJS += argument.o |
| 3 | libphosphor-hwmon.so_OBJS += directory.o |
| 4 | libphosphor-hwmon.so_OBJS += sensorset.o |
| 5 | |
| 6 | EXES += phosphor-hwmon-readd |
| 7 | phosphor-hwmon-readd_OBJS += readd.o |
| 8 | phosphor-hwmon-readd_LIBS += phosphor-hwmon |
| 9 | |
| 10 | #TODO: Issue#1 - Add the write-daemon for fan, pwm control. |
| 11 | #EXES += phosphor-hwmon-writed |
| 12 | #phosphor-hwmon-writed_OBJS += writed.o |
| 13 | #phosphor-hwmon-writed_LIBS += phosphor-hwmon |
| 14 | |
| 15 | #### -----------------------------------------------------------------------#### |
| 16 | # # |
| 17 | ## Compilare Regulas Sequi ## |
| 18 | # # |
| 19 | #### -----------------------------------------------------------------------#### |
| 20 | |
| 21 | CXXFLAGS ?= -O3 -g -pipe |
| 22 | CXXFLAGS += --std=gnu++14 -Wall -flto -fPIC |
| 23 | |
| 24 | define __BUILD_EXE |
| 25 | $1 : $$($1_OBJS) $$(LIBS) |
| 26 | $$(LINK.cpp) -o $$@ $$^ |
| 27 | |
| 28 | #include $$($1_OBJS:.o=.d) |
| 29 | endef |
| 30 | |
| 31 | $(foreach exe,$(EXES),$(eval $(call __BUILD_EXE,$(exe)))) |
| 32 | |
| 33 | define __BUILD_LIB |
| 34 | $1 : $$($1_OBJS) |
| 35 | $$(LINK.cpp) -shared -o $$@ $$^ |
| 36 | |
| 37 | #include $$($1_OBJS:.o=.d) |
| 38 | endef |
| 39 | |
| 40 | $(foreach lib,$(LIBS),$(eval $(call __BUILD_LIB,$(lib)))) |
| 41 | |
| 42 | .PHONY: clean |
| 43 | clean: |
| 44 | $(RM) $(foreach exe,$(EXES),$(exe) $($(exe)_OBJS)) \ |
| 45 | $(foreach lib,$(LIBS),$(lib) $($(lib)_OBJS)) |
| 46 | |
| 47 | DESTDIR ?= / |
| 48 | BINDIR ?= /usr/bin |
| 49 | LIBDIR ?= /usr/lib |
| 50 | |
| 51 | .PHONY: install |
| 52 | install: |
| 53 | install -m 0755 -d $(DESTDIR)$(BINDIR) |
| 54 | install -m 0755 $(EXES) $(DESTDIR)$(BINDIR) |
| 55 | install -m 0755 -d $(DESTDIR)$(LIBDIR) |
| 56 | install -m 0755 $(LIBS) $(DESTDIR)$(LIBDIR) |
| 57 | |
| 58 | .DEFAULT_GOAL: all |
| 59 | .PHONY: all |
| 60 | all: $(EXES) $(LIBS) |