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 # Potential python dependencies for generated files and scripts
36 # Add .pyc files to CLEAN list
38 PYTHON_FILES
=$(shell find
"${PYLIBSDIR}" -name
*.py
)
39 CLEAN
+=$(patsubst %.py
, %.pyc
, ${PYTHON_FILES})
42 # 1. Generate and include dependencies for all C sources
43 # 2. Generate OBJECTS list from CSOURCES list
44 # 3. Adds OBJECTS to CLEAN list
47 DEPFILES
=$(subst .c
,.dep
,$(CSOURCES
))
51 CLEAN
+=$(subst .c
,.dep
,$(CSOURCES
))
52 OBJECTS
=$(CSOURCES
:.c
=.o
)
57 # Automatically include library headers
64 # If there was anything in INCLUDE list, create CFLAGS for each entry
67 CFLAGS
+=$(addprefix -I
$(TOPDIR
)/include/, $(INCLUDE
))
71 # Walk trought SUBDIRS, this code works even for -jX
75 $(MAKE
) -C
$@
$(MAKECMDGOALS
)
77 @
export CURSUBDIR
="$$CURSUBDIR/$@" && echo
"DIR $$CURSUBDIR" &&\
78 $(MAKE
) --no-print-directory
-C
$@
$(MAKECMDGOALS
)
84 $(DEPFILES
): %.dep
: %.c
86 $(CC
) -MM
$(CFLAGS
) $< -o
$@
88 @echo
"DEP -I(include $(INCLUDE)) $@"
89 @
$(CC
) -MM
$(CFLAGS
) $< -o
$@
94 $(CC
) $(CFLAGS
) -c
$< -o
$@
96 @echo
"CC -I(include $(INCLUDE)) $@"
97 @
$(CC
) $(CFLAGS
) -c
$< -o
$@