Last active
October 7, 2024 18:16
-
-
Save mishurov/8134532 to your computer and use it in GitHub Desktop.
Makefile to build QT projects (Linux) without qmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=g++ | |
MOC=moc-qt4 | |
CFLAGS=-Wall | |
SOURCES=hello.cc hello_cls.cc | |
MOC_HEADERS=hello_cls.h | |
EXECUTABLE=hello | |
INCDIRS=-I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore | |
LIBS=-lQtCore -lQtGui | |
# Change postfixes | |
MOC_SOURCES=$(MOC_HEADERS:.h=.moc.cc) | |
OBJECTS=$(SOURCES:.cc=.o) $(MOC_SOURCES:.cc=.o) | |
all: $(EXECUTABLE) | |
@echo Done! | |
$(EXECUTABLE): $(OBJECTS) | |
$(CC) $^ $(LIBS) -o $@ | |
# Generate object files, rule to change postfix | |
%.o: %.cc | |
$(CC) $(CFLAGS) $(INCDIRS) -c $< -o $@ | |
# Generate cc from h via Qt's Meta Object Compiler, rule to change postfix | |
%.moc.cc: %.h | |
$(MOC) $(INCDIRS) $< -o $@ | |
.PHONY: tags clean | |
clean: | |
rm *.o | |
# Generate ctags file for all included files (autocomplete and jump to source) | |
tags: | |
gcc -M $(INCDIRS) $(SOURCES) | \ | |
sed -e 's/[\\ ]/\n/g' | \ | |
sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d' | \ | |
ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q |
@mishurov is there any chance I could get your permission to include your makefile with my Qt fork, under GPLv2 or BSD?
Why even ask that. Sure, of course. I'm not a lawyer. Everything I share, it is for public use.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@habaneropep2019 it is as old as mammoth shite. I'm working on time series rendered on GPU and QML.