0

Question as title.

Netbeans does not offer pre- or postbuild steps and also does not offer this setting by default. Is there any convinient way I can make this work or can I edit some configs? I think the makefile is getting regenerated when you add files etc.

I heavily rely on header only libs like boost or glm and my productivity depends on precompiled headers since it makes the code compile so much faster.

I use mingw as a compiler suite on windows and as language C++.


EDIT

My modified makefile after the first suggestion:

# Environment 
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin


# build
build: .build-post

.build-pre:
# Add your pre 'build' code here...
NightLight.hpp.gch: Nightlight.hpp 
    $(COMPILE.cc) $(CXXFLAGS) -g NightLight.hpp

.build-post: .build-impl
# Add your post 'build' code here...


# clean
clean: .clean-post

.clean-pre:
# Add your pre 'clean' code here...

.clean-post: .clean-impl
# Add your post 'clean' code here...
    $(RM) pch.h.gch
DeleteMe
  • 197
  • 1
  • 12
  • Google-fu: http://netbeans.org/bugzilla/show_bug.cgi?id=124123 – RedX Jul 27 '12 at 12:17
  • Thanks for your answer, I tried that, but it does nothing actually. In none of the directories, neither src nor build is a .gch file present after executing the makefile. I'll add the modified makefile to my opening post. – DeleteMe Jul 27 '12 at 12:38

1 Answers1

1

you have to add NightLight.hpp.gch after .build-pre: so that it is dependent on your target and will execute your target

example:

.build-pre: NightLight.hpp.gch
# Add your pre 'build' code here...
NightLight.hpp.gch: Nightlight.hpp 
    $(COMPILE.cc) $(CXXFLAGS) -g NightLight.hpp

the problem with this approach is that you must have the exact $(CXXFLAGS) as in the other makefiles or your .gch will just be ignored and you have to set them manually for debug/release etc. (look at how $(CXXFLAGS) is defined in i.e. "Makefile-Debug.mk" in your nbproject folder and replace it in your makefile) netbeans sucks with precompiled headers as far as i know

kanikani
  • 26
  • 1