-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (34 loc) · 934 Bytes
/
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
ifeq ($(BUILD),debug)
# "Debug" build - no optimization, and debugging symbols
CFLAGS += -O0 -g
else
# "Release" build - optimization, and no debug symbols
CFLAGS += -O2 -s -DNDEBUG
endif
# install dir
PREFIX = /usr/local
# the compiler: gcc for C program, define as g++ for C++
CC = gcc
# basic compiler flags:
CFLAGS += -Wall -std=gnu99
#files
OBJFILES = triacd.o optoboard.o fader.o
# the build target executable:
TARGET = triacd
LIBS += -lrt -pthread
all: $(TARGET)
debug:
make "BUILD=debug"
$(TARGET): $(OBJFILES)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJFILES) $(LIBS)
clean:
rm -f $(OBJFILES) $(TARGET) *~
install: $(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp $(TARGET) $(DESTDIR)$(PREFIX)/bin
cp $(TARGET).service $(DESTDIR)/etc/systemd/system
systemctl enable $(TARGET)
uninstall:
systemctl disable $(TARGET)
rm -f $(DESTDIR)/etc/systemd/system/$(TARGET).service
rm -f $(DESTDIR)$(PREFIX)/bin/$(TARGET)