%% [EMAIL PROTECTED] writes: xh> I have a makefile taht works well in normal execution. xh> But I try in parallel (-j) , I have sometimes some problem.
xh> lib: build_dir_setup $(DEST_DIR)/$(LIB) xh> build_dir_setup : xh> mkdir -p $(DEST_DIR) xh> The problem with that is the "build_dir_setup" target. This is xh> here to only build the directories where the final objs and the xh> lib will be. So it's mandatory that these 2 directories exists xh> before to do the link or the compilation. A line like this: foo: bar baz boz tells make _only_ that bar, baz, and boz must all be built and completed before it can start building foo. This line tells make _nothing_ about the relative order that bar, baz, and boz must be built in. During a serial build make convention says that the prerequisites will be built in the order in which they appear in the prerequisites list. During a parallel build, they will all be built at the same time (or as many as can be given your -j setting) unless you tell make that there are further dependencies between them. xh> however, if I build in parallel, it seems that it's trying to xh> build some objects before the build_dir_setup completed so xh> bringing error message like : xh> "Cannot open dir/toto.o" xh> how can I enforce this target to be processed before. You have to tell make that the other targets _also_ depend on that directory being built. In other words, every target that requires the build_dir_setup target to be run before it is run must say explicitly: <sometarget>: build_dir_setup But, the short answer is you _never_ want to create directories like this. There are many reasons why it's broken. Search the archives for this mailing list if you want to see them all. Instead, use $(shell ...) to do it: __dummy := $(shell [ -d $(DEST_DIR) ] || mkdir -p $(DEST_DIR)) -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
