-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
53 lines (44 loc) · 1.36 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
STATIC_LIBRARY=libboilerControl.a
DYNAMIC_LIBRARY=libboilerControl.so
INSTALLDIR=/usr/local/lib/
EXECINSTALLDIR=/usr/local/bin/
HEADERSINSTALLDIR=/usr/local/lib/libboilerControl
EXPORTHEADERS=TransmitPinFactory.h boilercontrol.h
all: callforheat $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
objects = TransmitPinFactory.o boilercontrol.o
ifeq ($(PLATFORM),pi)
objects += RaspberryPiTransmitPin.o
CXXFLAGS = -DRASPBERRY_PI
LDLIBS = -L/usr/local/lib -lwiringPi
else
objects += StubTransmitPin.o
endif
$(STATIC_LIBRARY): $(objects)
ar rcs $(STATIC_LIBRARY) $(objects)
ranlib $(STATIC_LIBRARY)
$(DYNAMIC_LIBRARY): $(objects)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $+ $(LDLIBS) -o $(DYNAMIC_LIBRARY)
callforheat: $(objects) callforheat.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) $+ -o $@ $(LDLIBS)
install:
sudo cp -p $(STATIC_LIBRARY) $(INSTALLDIR)
sudo cp -p $(DYNAMIC_LIBRARY) $(INSTALLDIR)
sudo mkdir -p $(HEADERSINSTALLDIR)
sudo cp -p $(EXPORTHEADERS) $(HEADERSINSTALLDIR)
chmod a+x callforheat
sudo cp -p callforheat $(EXECINSTALLDIR)
ifeq ($(PLATFORM),pi)
chmod a+x gpio-init.sh
sh gpio-init.sh
sh installStartupGpioConfig.sh
endif
uninstall:
rm -rf $(HEADERSINSTALLDIR)
rm $(INSTALLDIR)$(STATIC_LIBRARY)
rm $(INSTALLDIR)$(DYNAMIC_LIBRARY)
rm $(EXECINSTALLDIR)callforheat
ifeq ($(PLATFORM),pi)
sh unInstallStartupGpioConfig.sh
endif
clean:
$(RM) *.o callforheat $(STATIC_LIBRARY)