I am developing a multi-language application (c, c++, FORTRAN and soon Java...hopefully), and used qmake only once to create the makefile. Since then, I have been just updating the makefile each time by hand. I am trying to get the makefile to be able to handle generic filename redirections i.e (this is an example from the net, not my actual makefile...):

Qt Code:
  1. CXX=g++
  2. CC=gcc
  3. FC=pgf77
  4. CFLAGS=-c -Wall
  5. FFLAGS=
  6. LDFLAGS=
  7. SOURCES=main.cpp hello.cpp factorial.f
  8. OBJECTS=$(SOURCES:.cpp=.o)
  9. EXECUTABLE=hello
  10.  
  11. :
  12. :
  13.  
  14. all: $(SOURCES) $(EXECUTABLE)
  15.  
  16. $(EXECUTABLE): $(OBJECTS)
  17. $(CC) $(LDFLAGS) $(OBJECTS) -o $@
  18.  
  19. .cpp.o:
  20. $(CXX) $(CXXFLAGS) $< -o $@
  21.  
  22. .c.o:
  23. $(CC) $(CFLAGS) $< -o $@
  24.  
  25. .f.o:
  26. $(FC) $(FFLAGS) $< -o $@
  27.  
  28. #Steps for moc...
  29. ???
To copy to clipboard, switch view to plain text mode 
and moc the correct Q_OBJECT files at the same time. I have created a variable call MOC_FILES that lists all the files to be moc'd but each time I try and create a generic moc rule, nothing compiles. I am "so-so" at makefiles, and was wondering if anyone has sucessfully done this? Also, I am not using UI files or Project (.pro) files in Qt. I am writing all code by hand.