in a Makefile, I have:
all: $(PROG)
$(PROG): $(CPP_OBJS)
$(CPP_LD) $(CPP_LD_FLAGS) $(CPP_OBJS) -o $(PROG)
I would like to add some script before the compilation so I tried:
all: $(PROG)
$(PROG): $(CPP_OBJS)
sh script.sh ; $(CPP_LD) $(CPP_LD_FLAGS) $(CPP_OBJS) -o $(PROG)
but it does not work.
What is the right way of running a script in this case before the compilation?
Thanks
Put the script execution on a separate line.
This is because make is pretty stupid and doesn’t understand semicolons in the way you want. Good thing that newlines are cheap!