removing duplicate include paths in android makefile

121 Views Asked by At

I have a complicated set of android make files that include each other. As a result, LOCAL_C_INCLUDES of the main make file becomes very long with many duplicates of the same paths.

Is there some way to remove duplicates, perhaps by calling some function?

1

There are 1 best solutions below

0
Yakov Dan On

I solved this by calling a python script via shell. The script takes the current value of LOCAL_C_INCLUDES and returns it without duplicated paths, like this:

LOCAL_C_INCLUDES := $(shell python -c "import sys;print(' '.join(set(sys.argv[1].split())))" "$(LOCAL_C_INCLUDES)")