-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (52 loc) · 1.23 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
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# Software License Agreement (BSD License)
#
# Copyright (c) 2017, DUKELEC, Inc.
# All rights reserved.
#
# Author: Duke Fong <[email protected]>
#
INCLUDES = \
cdnet/parser \
cdnet/dispatch \
cdnet/utils \
cdnet/dev \
cdnet/arch/pc \
ip \
tun \
usr
C_SOURCES = \
usr/main.c \
usr/cd_args.c \
cdnet/parser/cdnet_l1.c \
cdnet/dev/cdbus_uart.c \
cdnet/dev/cdctl.c \
cdnet/arch/pc/arch_wrapper.c \
cdnet/utils/cd_list.c \
cdnet/utils/modbus_crc.c \
cdnet/utils/hex_dump.c \
dev_wrapper/cdbus_tty_wrapper.c \
dev_wrapper/cdctl_spi_wrapper.c \
dev_wrapper/linux_dev_wrapper.c \
ip/ip_cdnet_conversion.c \
ip/ip_checksum.c \
tun/tun.c
GIT_VERSION := $(shell git describe --dirty --always --tags)
CC = gcc
BUILD_DIR = build
TARGET = cdnet_tun
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
I_INCLUDES = $(foreach includedir,$(INCLUDES),-I$(includedir))
CFLAGS = $(I_INCLUDES) -DSW_VER=\"$(GIT_VERSION)\"
LDFLAGS = -lgpiod
DEPS = $(foreach includedir,$(INCLUDES),$(wildcard $(includedir)/*.h))
$(BUILD_DIR)/%.o: %.c $(DEPS) Makefile | $(BUILD_DIR)
$(CC) -c -o $@ $< $(CFLAGS)
$(TARGET): $(OBJECTS)
$(CC) -o $@ $^ $(LDFLAGS)
$(BUILD_DIR):
mkdir $@
.PHONY: clean
clean:
rm -rf $(BUILD_DIR) $(TARGET)