-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (35 loc) · 852 Bytes
/
Copy pathMakefile
File metadata and controls
47 lines (35 loc) · 852 Bytes
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
USE_PIGPIOD = false
ifeq ($(USE_PIGPIOD), true)
GPIOLIB = pigpiod_if
GPIODEFINE = -DUSE_PIGPIOD
else
GPIOLIB = pigpio
GPIODEFINE =
endif
TARGET = wt440hrx
CC = gcc
CFLAGS = -O3 -Wall -fomit-frame-pointer $(GPIODEFINE)
LIBS = -l$(GPIOLIB) -lpthread -lrt
LFLAGS = -s
INSTALLDIR = /opt/fhem
ifeq ($(USE_PIGPIOD), true)
INSTALL = sudo install -m 755 -o fhem -g dialout
else
INSTALL = sudo install -m 755 -o root -g root
endif
.PHONY: default all clean
default: $(TARGET)
all: default
OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
HEADERS = $(wildcard *.h)
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(LFLAGS) $(OBJECTS) -Wall $(LIBS) -o $@
clean:
-rm -f *.o
-rm -f $(TARGET)
install: $(TARGET)
$(INSTALL) wt440h2fhem.sh $(INSTALLDIR)
$(INSTALL) -s wt440hrx $(INSTALLDIR)