c++ - Makefile with directories -
my makefile fine. however, want have folder named "makefile" , folder named "main", first contain makefiles , second contain files meant main()
of my project, k-d geraf.
for now, header files lie in same folder. folder contains makefile folder , main folder.
here makefile (have tried many combinations, last attempt):
objs = main_par_auto.o source = ../main/main_par_auto.cpp header = ../division_euclidean_space.h ../find_diameter.h ../find_k_max.h ../householder.h ../io.h ../mean_variance.h ../point.h ../random_generator.h ../random_kd_forest.h ../tree.h ../auto_random_kd_forest.h out = geraf cxx = g++ flags = -pthread -std=c++0x -drkd_par -o3 -wall all: $(objs) $(cxx) $(objs) -o $(out) $(flags) # create/compile individual files >>separately<< main_par_auto.o: main_par_auto.cpp $(cxx) -c ../main/main_par_auto.cpp $(flags) .phony : # clean house clean: rm -f $(objs)
and getting error:
make: *** no rule make target `main_par_auto.cpp', needed `main_par_auto.o'. stop.
i executing command: make -f makefile/makefile_par_auto
in order compile.
what missing please?
this big picture ( literally :) )
the paths in makefile have relative working directory (the directory run make), not directory contains makefile. with
main_par_auto.o: main/main_par_auto.cpp $(cxx) -c main/main_par_auto.cpp $(flags)
you should expected results.
note unusual expect user invoke make
way. normally, you'd expect have makefile in directory call make
(that may or may not go on use other makefiles in other directories).
Comments
Post a Comment