How to ensure Makefile variable is set as a prerequisite?

This will cause a fatal error if ENV is undefined and something needs it (in GNUMake, anyway). .PHONY: deploy check-env deploy: check-env … other-thing-that-needs-env: check-env … check-env: ifndef ENV $(error ENV is undefined) endif (Note that ifndef and endif are not indented – they control what make “sees”, taking effect before the Makefile is run. … Read more

Why is no one using make for Java?

The fundamental issue with Make and Java is that Make works on the premise that you have specify a dependency, and then a rule to resolve that dependency. With basic C, that typically “to convert a main.c file to a main.o file, run “cc main.c”. You can do that in java, but you quickly learn … Read more

Compiling C++ on remote Linux machine – “clock skew detected” warning

That message is usually an indication that some of your files have modification times later than the current system time. Since make decides which files to compile when performing an incremental build by checking if a source files has been modified more recently than its object file, this situation can cause unnecessary files to be … Read more

Make install, but not to default directories?

It depends on the package. If the Makefile is generated by GNU autotools (./configure) you can usually set the target location like so: ./configure –prefix=/somewhere/else/than/usr/local If the Makefile is not generated by autotools, but distributed along with the software, simply open it up in an editor and change it. The install target directory is probably … Read more

How to abort makefile if variable not set?

TL;DR: Use the error function: ifndef MY_FLAG $(error MY_FLAG is not set) endif Note that the lines must not be indented. More precisely, no tabs must precede these lines. Generic solution In case you’re going to test many variables, it’s worth defining an auxiliary function for that: # Check that given variables are set and … Read more

How can I configure my makefile for debug and release builds?

You can use Target-specific Variable Values. Example: CXXFLAGS = -g3 -gdwarf2 CCFLAGS = -g3 -gdwarf2 all: executable debug: CXXFLAGS += -DDEBUG -g debug: CCFLAGS += -DDEBUG -g debug: executable executable: CommandParser.tab.o CommandParser.yy.o Command.o $(CXX) -o output CommandParser.yy.o CommandParser.tab.o Command.o -lfl CommandParser.yy.o: CommandParser.l flex -o CommandParser.yy.c CommandParser.l $(CC) -c CommandParser.yy.c Remember to use $(CXX) or $(CC) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)