-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
47 lines (34 loc) · 927 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
# UT181A makefile
# loblab, 12/15/2017
TARGET=ut181a
ARCH=$(shell uname -m)
OUTDIR ?= ./bin/$(ARCH)
TMPDIR ?= ./tmp/$(ARCH)
SRCDIR = ./src
all: $(TARGET)
CC ?= gcc
CFLAGS ?= -Wall -g $(ARCHFLAG)
CXX ?= g++
CXXFLAGS ?= -Wall -g $(ARCHFLAG)
COBJS =
CPPOBJS = $(addprefix $(TMPDIR)/, debug.o reader.o writer.o packet.o cp211x.o ut181a.o main.o)
OBJS = $(COBJS) $(CPPOBJS)
LDFLAGS ?= -L/usr/local/lib
LIBS ?= -lslabhidtouart -lslabhiddevice
INCLUDES ?= -Iinc
$(TARGET): $(OUTDIR) $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(OUTDIR)/$(TARGET)
$(COBJS): $(TMPDIR)
$(COBJS): $(TMPDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
$(CPPOBJS): $(TMPDIR)
$(CPPOBJS): $(TMPDIR)/%.o: $(SRCDIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@
$(TMPDIR):
mkdir -p $(TMPDIR)
$(OUTDIR):
mkdir -p $(OUTDIR)
clean:
rm -rf $(TMPDIR)
rm -rf $(OUTDIR)
.PHONY: clean