I’m trying to create a makefile to build with different flavors.
i.e.
platformA: CC := gcc
platformB: CC := some-3rd-party-gcc
DIRS := $(shell find ad/src -type d)
$(shell find ad/api -type d)
BUILD_DIR := ad/obj
INCLUDES = $(addprefix -I,$(DIRS) $(EXTRA))
SOURCES = $(shell find $(DIRS) -maxdepth 1 -name '*.c')
$(shell find $(EXTRA) -maxdepth 1 -name '*.c')
OBJECTS = $(patsubst %,$(BUILD_DIR)/%,$(SOURCES:.c=.o))
platformA: EXTRA = $(shell find /ad/platA -type d)
platformB: EXTRA = $(shell find /ad/platB -type d)
platformA platformB: TARGET=output
$(TARGET): $(OBJECTS)
@echo Prequisitoins: $(OBJECTS) | sed -e "s/ /n/g"
@echo "-------------------"
@echo Prequisitoins: $? | sed -e "s/ /n/g"
@echo "-------------------"
(I have shortened the parts I copied here, just to show the issue)
When I run the makefile, I get different output, from the $(OBJECTS) echo line and from the ($?) echo line.
What am I missing here?