jeudi 22 septembre 2016

Makefile and putting objects and executable to subdirectory

I have been trying to read around about this, but I can't figure out how to fix it.

I have the following makefile and I would like to put objects in to libs/ subfolder and executable to build/ folder...but no matter what I have tried, I can't figure out how to tell make such ruling.

cxx = g++
flags = -mwindows
sources = $(wildcard *.cpp)
objects = $(sources:.cpp=.o)
target = engine

all: $(sources) $(target)

$(target): $(objects)
    $(cxx) $(objects) -o $@

.cpp.o:
    $(cxx) -std=c++11 -c $< -o $@

Aucun commentaire:

Enregistrer un commentaire