私の解決策があなたに役立つかもしれません。 メイクファイルで私の転向pro-Filesを作成します。 まずプログラムへのフィッティングシンプルなメイク:私のプロジェクトツリーでプログラムを作成 例
SHELL = /bin/bash
BUILD_PATH := $(shell cd ../../../; pwd)
CONF_PATH := $(BUILD_PATH)/sources/config
BIN_PATH := $(BUILD_PATH)/bin
LIB_PATH := $(BUILD_PATH)/lib
INS_PATH := /usr/local
MODULES := core gui widgets printsupport
TARGET := CCDDataDisplay
TEMPLATE := app
DEFINES :=
INCLUDES := $(BUILD_PATH)/sources/include
LIBS := -L$(LIB_PATH) -lhrlLib
DESTDIR := $(BIN_PATH)
MOCS := MainWindow.h
include $(CONF_PATH)/conf_qmake.mk
conf_qmake.mk:
QMAKE := qmake-qt5
HEADERS := $(wildcard *.h)
C_SOURCES := $(wildcard *.c)
CPP_SOURCES := $(wildcard *.cpp)
SOURCES := $(C_SOURCES)
SOURCES += $(CPP_SOURCES)
FORMS := $(wildcard *.ui)
.PHONY: all
all: depdirs
@echo -e "\n\x1b[32;01m Building \x1b[34;01m$(TARGET)\x1b[32;01m in $(shell pwd) ... \x1b[0m"
@if [ ! -d .build ]; \
then \
rm -f qmake.pro; \
cp $(CONF_PATH)/qmake.pro qmake.pro;\
mkdir -p .build; \
cd .build; \
$(QMAKE) -makefile "MODULES_IN=$(MODULES)" \
"TARGET_IN=$(TARGET)" \
"TEMPLATE_IN=$(TEMPLATE)" \
"DEFINES_IN=$(DEFINES)" \
"INCLUDES_IN=$(INCLUDES)" \
"LIBS_IN=$(LIBS)" \
"DESTDIR_IN=$(DESTDIR)" \
"SOURCES_IN=$(SOURCES)" \
"MOCS=$(MOCS)" \
"FORMS_IN=$(FORMS)" \
../qmake.pro >> /dev/null; \
fi;
@$(MAKE) -s -C .build;
.PHONY: depdirs
depdirs:
@$(foreach dir, $(DEPDIRS), $(MAKE) -s -C $(dir);)
.PHONY: install
install:
@$(MAKE) -s -C .build install;
.PHONY: realclean clean distclean
clean:
@if [ -d .build ]; then $(MAKE) -s -C .build clean; fi
@$(RM) *~;
@$(RM) $$(BUILD_PATH)/include/*~;
realclean:
@$(RM) -r .build;
@$(RM) qmake.pro;
@$(RM) *~;
@$(RM) $(BUILD_PATH)/include/*~;
distclean: realclean
@$(RM) $(BUILD_PATH)/bin/$(TARGET);
@$(RM) $(BUILD_PATH)/lib/lib$(TARGET)*;
と最後qmake.pro:
QT += $$MODULES_IN
TARGET = $$TARGET_IN
TEMPLATE = $$TEMPLATE_IN
CONFIG += staticlib
DEFINES += $$DEFINES_IN
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
INCLUDEPATH += $$INCLUDES_IN
LIBS += $$LIBS_IN
DESTDIR = $$DESTDIR_IN
SOURCES += $$SOURCES_IN
HEADERS += $$MOCS
FORMS += $$FORMS_IN
unix {
target.path = /usr/local
INSTALLS += target
}
これと一緒に
私は生成するための静かな単純なmakefileを持っています。 プロジェクト全体のビルドは、 プロジェクトツリーの上に1つのメイクファイルで行います。
おそらく、これが役立ちます...