QT용 Makefile

qmake가 생성해주는 Makefile은 너무.. 너저분하다..
아래와 같이 심플하게 만들어 봤다.


QT = c:/Qt/2010.05/qt
CC = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL \
		  -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB \
		  -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -O2 -frtti -fexceptions -mthreads -Wall $(DEFINES)
INCPATH = -I$(QT)/include/QtCore -I$(QT)/include/QtGui \
		  -I$(QT)/include -I$(QT)/include/ActiveQt \
		  -I$(QT)/mkspecs/win32-g++
LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import \
		 -Wl,-enable-runtime-pseudo-reloc \
		 -mthreads -Wl -Wl,-subsystem,windows
LIBS = -L$(QT)/lib -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 

SOURCES     = main.cpp mainwindow.cpp \
			  moc_mainwindow.cpp qrc_dockwidgets.cpp
TARGET      = dockwidgets.exe
OBJECTS 	= $(SOURCES:.cpp=.o)

.SUFFIXES:
.SUFFIXES: .cpp .o
.cpp.o:
	$(CC) -c $(CFLAGS) $(INCPATH) -o $*.o $<

all: $(TARGET)

moc_%.cpp: %.h
	moc $< -o $@

qrc_%.cpp: %.qrc
	rcc -name $(basename $<) $< -o $@

$(TARGET): $(OBJECTS)
	$(CC) $(LFLAGS) -o $@ $(OBJECTS) $(LIBS)

clean:
	rm -f *.o *.exe moc_*.cpp qrc_*.cpp