Rayven
8th September 2006, 02:17
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...):
CXX=g++
CC=gcc
FC=pgf77
CFLAGS=-c -Wall
FFLAGS=
LDFLAGS=
SOURCES=main.cpp hello.cpp factorial.f
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=hello
:
:
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CXX) $(CXXFLAGS) $< -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
.f.o:
$(FC) $(FFLAGS) $< -o $@
#Steps for moc...
???
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.
CXX=g++
CC=gcc
FC=pgf77
CFLAGS=-c -Wall
FFLAGS=
LDFLAGS=
SOURCES=main.cpp hello.cpp factorial.f
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=hello
:
:
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CXX) $(CXXFLAGS) $< -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
.f.o:
$(FC) $(FFLAGS) $< -o $@
#Steps for moc...
???
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.