-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
48 lines (37 loc) · 1 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
DESTDIR?=/usr
PREFIX?=/local
ifneq ($V,1)
Q ?= @
endif
CC = gcc
CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
LIBS = -lpthread -lrt -lm -lcrypt
SRC = src/megaind.c src/comm.c src/thread.c src/opto.c src/wdt.c src/rtc.c src/rs485.c src/analog.c src/dout.c
OBJ = $(SRC:.c=.o)
all: megaind
megaind: $(OBJ)
$Q echo [Link]
$Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
.c.o:
$Q echo [Compile] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
.PHONY: clean
clean:
$Q echo "[Clean]"
$Q rm -f $(OBJ) megaind *~ core tags *.bak
.PHONY: install
install: megaind
$Q echo "[Install]"
$Q cp megaind $(DESTDIR)$(PREFIX)/bin
ifneq ($(WIRINGPI_SUID),0)
$Q chown root:root $(DESTDIR)$(PREFIX)/bin/megaind
$Q chmod 4755 $(DESTDIR)$(PREFIX)/bin/megaind
endif
# $Q mkdir -p $(DESTDIR)$(PREFIX)/man/man1
# $Q cp megaio.1 $(DESTDIR)$(PREFIX)/man/man1
.PHONY: uninstall
uninstall:
$Q echo "[UnInstall]"
$Q rm -f $(DESTDIR)$(PREFIX)/bin/megaind
$Q rm -f $(DESTDIR)$(PREFIX)/man/man1/megaind.1