I've got the following situation in my makefile:
SDLINC_NOVA = -I/usr/local/lib/sdl_2.0.5/include/SDL2 -D_REENTRANT
SDLLIB_NOVA = -L/usr/local/lib/sdl_2.0.5/lib -Wl,-rpath,/usr/local/lib/sdl_2.0.5/lib -Wl,--enable-new-dtags -lSDL2 -lSDL2main
SDLINC_MAC = -I/usr/local/SDL/include -D_REENTRANT
SDLLIB_MAC = -L/usr/local/SDL/lib -Wl,-rpath,/usr/local/SDL/lib -Wl,-install_name,--enable-new-dtags -lSDL2 -lSDL2main
....
.PHONY: all nova mac clean
all: nova
nova: SDLINC = $(SDLINC_NOVA)
nova: SDLLIB = $(SDLLIB_NOVA)
nova: build
mac: SDLINC = $(SDLINC_MAC)
mac: SDLLIB = $(SDLLIB_MAC)
mac: build
build: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) $(SDLLIB) -o $@
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
$(CC) $(CFLAGS) $(SDLINC) -c $< -o $@
It feels like I'm doing something wrong.. Basically the SDLINC and SDLLIB variables should contain different value based on the rule that is called, and then the build rule should be called.
What is the right convention to achieve that in a makefile?
macmeans that you are building in Mac OS, but what is Nova then?make macto debug on my machine, butmake/make novato work as default.