summaryrefslogtreecommitdiff
path: root/utility/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'utility/Makefile')
-rw-r--r--utility/Makefile27
1 files changed, 22 insertions, 5 deletions
diff --git a/utility/Makefile b/utility/Makefile
index 5386089b91..660117744a 100644
--- a/utility/Makefile
+++ b/utility/Makefile
@@ -2,10 +2,27 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-all: ec_uartd
+CFLAGS += $(INCLUDES)
+CFLAGS += -MMD -MF $@.d
+HOSTCC = cc
-clean:
- rm -f ec_uartd
+BUILD_ROOT = ${BUILD}/utility
-ec_uartd: ec_uartd.c
- gcc -o ec_uartd -lftdi ec_uartd.c
+DESTDIR ?= /usr/bin
+
+TARGET_NAMES = ec_uartd
+
+TARGET_BINS = $(addprefix ${BUILD_ROOT}/,$(TARGET_NAMES))
+ALL_DEPS = $(addsuffix .d,${TARGET_BINS})
+
+all: $(TARGET_BINS)
+
+${BUILD_ROOT}/ec_uartd: ec_uartd.c $(LIBS)
+ $(CC) $(CFLAGS) $< -o $@ $(LIBS) -lftdi
+
+install: $(TARGET_BINS)
+ mkdir -p $(DESTDIR)
+ cp -f $(TARGET_BINS) $(DESTDIR)
+ chmod a+rx $(patsubst %,$(DESTDIR)/%,$(TARGET_NAMES))
+
+-include ${ALL_DEPS}