2 # Make no subdirs by default
8 .PHONY
: $(SUBDIRS
) all clean help
14 @echo
"*** Available targets ***"
16 @echo
"help: prints this help"
18 @echo
"clean: cleans current directory and all subdirectories"
20 @echo
"all: make current directory and all subdirectories"
22 @echo
"The default silent output could be turned off by defining"
23 @echo
"'VERBOSE' shell variable as 'VERBOSE=1 make'"
26 include $(TOPDIR
)/config.mk
29 # Determine mode (eg do not generate anything if not in compile mode
33 ifeq ($(MAKECMDGOALS
),all)
37 ifeq ($(MAKECMDGOALS
),)
42 # Potential python dependencies for generated files and scripts
44 PYTHON_FILES
=$(shell find
"${PYLIBSDIR}" -name
'*.py')
47 # 1. Generate and include dependencies for all C sources
48 # 2. Generate OBJECTS list from CSOURCES list
49 # 3. Adds OBJECTS to CLEAN list
52 DEPFILES
=$(subst .c
,.dep
,$(CSOURCES
))
56 CLEAN
+=$(subst .c
,.dep
,$(CSOURCES
))
57 OBJECTS
=$(CSOURCES
:.c
=.o
)
62 # Automatically include library headers
69 # If there was anything in INCLUDE list, create CFLAGS for each entry
72 CFLAGS
+=$(addprefix -I
$(TOPDIR
)/include/, $(INCLUDE
))
76 # Walk trought SUBDIRS, this code works even for -jX
80 $(MAKE
) -C
$@
$(MAKECMDGOALS
)
82 @
export CURSUBDIR
="$$CURSUBDIR/$@" && echo
"DIR $$CURSUBDIR" &&\
83 $(MAKE
) --no-print-directory
-C
$@
$(MAKECMDGOALS
)
89 $(DEPFILES
): %.dep
: %.c
91 $(CC
) -MM
$(CFLAGS
) $< -o
$@
93 @echo
"DEP -I(include $(INCLUDE)) $@"
94 @
$(CC
) -MM
$(CFLAGS
) $< -o
$@
99 $(CC
) $(CFLAGS
) -c
$< -o
$@
101 @echo
"CC -I(include $(INCLUDE)) $@"
102 @
$(CC
) $(CFLAGS
) -c
$< -o
$@