|
@@ -1,5 +1,7 @@
|
1
|
1
|
CC = $(CROSS)$(TARGET)gcc
|
2
|
2
|
LINK = $(CROSS)$(TARGET)ld -o
|
|
3
|
+MKDEP = $(CROSS)$(TARGET)$(CC) -M -o $*.d $<
|
|
4
|
+
|
3
|
5
|
LIBRARY_LINK_OPTS = -L. -r
|
4
|
6
|
CFLAGS = -O2 -ggdb -std=c99 -D_GNU_SOURCE
|
5
|
7
|
CFLAGS += -Wall -Wextra -Wshadow -Wformat-security -Wstrict-prototypes
|
|
@@ -18,11 +20,14 @@ $(PROG): $(OBJS)
|
18
|
20
|
$(Q)$(LINK) $@ $(LIBRARY_LINK_OPTS) $(OBJS)
|
19
|
21
|
|
20
|
22
|
%.o: %.c libfuncs.h
|
|
23
|
+ @$(MKDEP)
|
21
|
24
|
$(Q)echo " CC libfuncs $<"
|
22
|
25
|
$(Q)$(CC) $(CFLAGS) -c $<
|
23
|
26
|
|
|
27
|
+-include $(OBJS:.o=.d)
|
|
28
|
+
|
24
|
29
|
clean:
|
25
|
|
- $(Q)echo " RM $(PROG) $(OBJS)"
|
26
|
|
- $(Q)$(RM) $(PROG) *.o core *.core *~
|
|
30
|
+ $(Q)echo " RM $(PROG) $(OBJS:.o=.{o,d})"
|
|
31
|
+ $(Q)$(RM) $(PROG) $(OBJS:.o=.{o,d}) *~
|
27
|
32
|
|
28
|
33
|
distclean: clean
|