summaryrefslogtreecommitdiff
path: root/extra/usb_updater/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'extra/usb_updater/Makefile')
-rw-r--r--extra/usb_updater/Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/extra/usb_updater/Makefile b/extra/usb_updater/Makefile
index 49b8a1af2c..fedb959356 100644
--- a/extra/usb_updater/Makefile
+++ b/extra/usb_updater/Makefile
@@ -41,9 +41,16 @@ LIBS_common = -lfmap
all: $(PROGRAMS)
+GSCTOOL_SOURCES := gsctool.c
+GSCTOOL_OBJS := $(patsubst %.c,%.o,$(GSCTOOL_SOURCES))
+DEPS := $(patsubst %.c,%.d,$(GSCTOOL_SOURCES))
+
# chip/g updater
-gsctool: gsctool.c Makefile
- $(CC) $(CFLAGS) $(CFLAGS_g) $< $(LFLAGS) $(LIBS) $(LIBS_g) -o $@
+gsctool: $(GSCTOOL_OBJS) Makefile
+ $(CC) $(GSCTOOL_OBJS) $(LFLAGS) $(LIBS) $(LIBS_g) -o $@
+
+%.o: %.c
+ $(CC) $(CFLAGS) $(CFLAGS_g) -c -MMD -MF $(basename $@).d -o $@ $<
# common EC code USB updater
usb_updater2: usb_updater2.c Makefile
@@ -52,4 +59,6 @@ usb_updater2: usb_updater2.c Makefile
.PHONY: clean
clean:
- rm -rf $(PROGRAMS) *~
+ rm -rf $(PROGRAMS) *~ *.o *.d
+
+-include $(DEPS)