blob: 49a7e4dec141a003829c77a71776420e0c3062b6 [file] [log] [blame]
Patrick Williams3667cf32015-10-20 22:39:11 -05001LIBS += libphosphor-hwmon.so
2libphosphor-hwmon.so_OBJS += argument.o
3libphosphor-hwmon.so_OBJS += directory.o
4libphosphor-hwmon.so_OBJS += sensorset.o
5
6EXES += phosphor-hwmon-readd
7phosphor-hwmon-readd_OBJS += readd.o
8phosphor-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
21CXXFLAGS ?= -O3 -g -pipe
22CXXFLAGS += --std=gnu++14 -Wall -flto -fPIC
23
24define __BUILD_EXE
25$1 : $$($1_OBJS) $$(LIBS)
26 $$(LINK.cpp) -o $$@ $$^
27
28#include $$($1_OBJS:.o=.d)
29endef
30
31$(foreach exe,$(EXES),$(eval $(call __BUILD_EXE,$(exe))))
32
33define __BUILD_LIB
34$1 : $$($1_OBJS)
35 $$(LINK.cpp) -shared -o $$@ $$^
36
37#include $$($1_OBJS:.o=.d)
38endef
39
40$(foreach lib,$(LIBS),$(eval $(call __BUILD_LIB,$(lib))))
41
42.PHONY: clean
43clean:
44 $(RM) $(foreach exe,$(EXES),$(exe) $($(exe)_OBJS)) \
45 $(foreach lib,$(LIBS),$(lib) $($(lib)_OBJS))
46
47DESTDIR ?= /
48BINDIR ?= /usr/bin
49LIBDIR ?= /usr/lib
50
51.PHONY: install
52install:
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
60all: $(EXES) $(LIBS)