i was reading this post on makefile. I found that I cannot find where are the compiler and compilation flags defined. Normally they are defined as CXX and CFLAGS
i copied this makefile for my own testing project:
BUILD_DIR := /home/ubuntu/workspace/common/bin
vpath %.cpp /home/ubuntu/workspace/common/src
SRCS := basic_types.cpp
OBJS := ${SRCS:%.cpp=${BUILD_DIR}/%.o}
foo: ${OBJS}
@echo Linking $@ using $?
@touch $@
${BUILD_DIR}/%.o: %.cpp # <-- I had thought there will be some more specific 'rules' here
@mkdir -p $(dir $@)
@echo Compiling $< ...
@touch $@
${SRCS}:
@echo Creating $@
@mkdir -p $(dir $@)
@touch $@
.PHONY: clean
it compiles well, but i still cannot find any where to specify the complier. Is Make intelligently select the compiler (g++) for me based on surffix?
could anyone take a look and enlight me a bit? thanks a lot!