Reputation: 563
As I understand it, when developing C++ in Qt Creator with a generated makefile, the .config file is transparently prepended to each .h file.
Let's say the .config file lives in the root directory, and we have directories for src/ and inc/ under that. The .config file is basically just a list of #define
constants. One normally does not have to explicitly #include
it.
What is the best way to emulate this in a custom (imported) makefile, so that the .config file is not explicitly included in each .h?
Thanks for any help.
Snippet of my current src/makefile:
VALID_TOOLCHAINS := pnacl
NACL_SDK_ROOT ?= $(abspath ../../prg/nacl_sdk/pepper_canary)
include ../common.mk
APP_SOURCES = Common.cc App.cc MoreMath.cc AppGraph.cc AppAudio.cc Noise.cc
TARGET = nim
INC_PATHS = $(NACL_SDK_ROOT)/include ../inc
LIBS = ppapi_gles2 ppapi_cpp ppapi pthread
CFLAGS = -Wall
SOURCES = $(APP_SOURCES) Neonim.cc
# Build rules generated by macros from common.mk:
$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
ifeq ($(CONFIG),Release)
$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
else
$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
endif
$(eval $(call NMF_RULE,$(TARGET),))
Upvotes: 0
Views: 179
Reputation: 8698
It is usually qmake that generates the makefile when we deal with Qt, no matter if we use Qt Creator or not. qmake consumes MyAppProjectFile.pro file with all the project files, compiler and linker options, pre- and post- build steps listed there. Start from the link pointing to qmake. As soon as you get the idea how the Qt project is organized you will probably ask us more "detailed" question so we'd be able to understand that and answer it better.
When I studied Qt some years ago I went through Qt examples and compiled them from command line and tried to change that code. Setting up command line environment for building Qt apps and examples will be a very good exercise. You will also be able to build your own project create in Qt creator but from command line -- that is really easy and enlightens a lot in the field of what files used, etc.
Upvotes: 1