1 .PHONY
: $(SUBDIRS
) all clean help
7 @echo
"*** Available targets ***"
9 @echo
"help: prints this help"
11 @echo
"clean: cleans current directory and all subdirectories"
13 @echo
"all: make current directory and all subdirectories"
15 @echo
"The default silent output could be turned off by defining"
16 @echo
"'VERBOSE' shell variable as 'VERBOSE=1 make'"
19 include $(TOPDIR
)/config.mk
22 # Determine mode (eg do not generate anything if not in compile mode
26 ifeq ($(MAKECMDGOALS
),all)
30 ifeq ($(MAKECMDGOALS
),)
35 # 1. Generate and include dependencies for all C sources
36 # 2. Generate OBJECTS list from CSOURCES list
37 # 3. Adds OBJECTS to CLEAN list
40 DEPFILES
=$(subst .c
,.dep
,$(CSOURCES
))
44 CLEAN
+=$(subst .c
,.dep
,$(CSOURCES
))
45 OBJECTS
=$(CSOURCES
:.c
=.o
)
50 # Automatically include library headers
57 # If there was anything in INCLUDE list, create CFLAGS for each entry
60 CFLAGS
+=$(addprefix -I
$(TOPDIR
)/include/, $(INCLUDE
))
64 # Walk trought SUBDIRS, this code works even for -jX
68 $(MAKE
) -C
$@
$(MAKECMDGOALS
)
70 @
export CURSUBDIR
="$$CURSUBDIR/$@" && echo
"DIR $$CURSUBDIR" &&\
71 $(MAKE
) --no-print-directory
-C
$@
$(MAKECMDGOALS
)
77 $(DEPFILES
): %.dep
: %.c
79 $(CC
) -MM
$(CFLAGS
) $< -o
$@
81 @echo
"DEP -I(include $(INCLUDE)) $@"
82 @
$(CC
) -MM
$(CFLAGS
) $< -o
$@
87 $(CC
) $(CFLAGS
) -c
$< -o
$@
89 @echo
"CC -I(include $(INCLUDE)) $@"
90 @
$(CC
) $(CFLAGS
) -c
$< -o
$@