makefile - How do you automate a make file? -


how make makefile go through list of .cpp files , compile separately, statically?

test: test.o         g++ -o test test.o test.o: test.cc test.hh         g++ -c test.cc 

but dynamically this?

sources = main.cpp someclass.cpp otherfile.cpp 

objects = main.o someclass.o otherfile.o  all: $objects  %.o: %.cc    g++ $< -c -o $@ 

if want enforce like-named headers each module, too, can:

objects = main.o someclass.o otherfile.o  all: $objects  %.o: %.cc %.hh    g++ $< -c -o $@ 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -