c++ - Auto moc file generation in Makefile -


so have pretty standard make file

#!/bin/bash  cxx=g++ cxxflags= -g -wall  sources=$(wildcard src/*.cpp) objects=$(addprefix obj/,$(notdir $(sources:.cpp=.o)))  includes=-i/usr/include/ -i. -i/usr/include/boost/ ldflags=-l/usr/lib64/ libs=-lqtgui -lqtcore  moc=moc-qt4 uic=uic-qt4 rm=rm  depfile=.depend target=foo  .phony=all clean distclean  all: depend $(target)  $(target): $(objects)     @echo linking $@     $(cxx) $^ $(ldflags) $(libs) -o $@  obj/%.o: src/%.cpp     @echo compiling $<     $(cxx) -c $(cxxflags) $(includes) $< -o $@  ui_%.h: %.ui     @echo uic'ing $<     $(uic) $< -o $@  src/moc_nodewindow.cpp: src/nodewindow.h     $(moc) $(cxxflags) $(includes) $< -o $@  src/moc_nodeeditor.cpp: src/nodeeditor.h     $(moc) $(cxxflags) $(includes) $< -o $@  clean:     $(rm) $(objects) src/*~ $(target) $(depfile)  depend: $(depfile)     @touch $(depfile)  $(depfile):     @echo generating dependecies in $@     @-$(cc) -e -mm $(cflags) $(includes) $(sources) >> $(depfile)  ifeq (,$(findstring clean,$(makecmdgoals))) ifeq (,$(findstring distclean,$(makecmdgoals))) -include $(dep_file) endif endif 

now i've been trying pick go along, can't automatically compile .cpp file ui , moc files.

the rules ui , moc files qt documentation i'm not sure how incorporate them make rule.

any needs done?

cheers


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -