|
From: Daniel J S. <dan...@ie...> - 2006-06-13 06:13:17
|
Ethan A Merritt wrote: > On Saturday 10 June 2006 10:33 am, Petr Mikulik wrote: > >>Somebody has added new file bin_hook.o into makefile.all. > > > Huh? It was added in 2004. > > >>This strange file >>does just #include "binary.c". Consequently, makefiles including >>makefile.all fail to link gnuplot because of multiple definitions from >>bin_hook.o and binary.o (e.g. makefile.mgw). Hmm, that seems like something isn't programmed correctly. What platform is makefile.mgw, i.e., what variables are defined for the compilation you are trying? > According to the ChangeLog comment, bin_hook.o was supposed to replace > binary.o Yes, well not so much replace, but be a form of conditionally including binary.c. But it does replace binary.c in the list of gnuplot_SOURCES = alloc.c alloc.h ansichek.h axis.c axis.h bin_hook.c \ breaders.c breaders.h bitmap.c bitmap.h color.c color.h command.c \... > >>Which one to remove from makefile.all? Or another action to take? > > > But you are correct. That doesn't seem to be what really happened. > So far as I can tell, bin_hook is not used anywhere and should > be deleted altogether. Both the source file and the mention of it in > the Makefiles are superfluous. > > Daniel: > This was your addition, correct? Yes, that was from pretty far back. I don't see how Lars' name got tied in with that. > Is it really correct > that bin_hook is not referred to anywhere, in any source file? > > I take it that the idea was to make inclusion of the routines in binary.o > into the final executable be conditional on BINARY_DATA_FILE. Yes, the reason for this hook is that binary.c is needed for two programs, that special C program to generate binary data and gnuplot in the case BINARY_DATA_FILE is not active. When BINARY_DATA_FILE is active, from what I recall, a few extra lines of code achieved what the code in binary.c does. The reason for the hook is that binary.c must be present for the bf_test.c program that generates binary data. From the Makefile.am: bf_test_SOURCES = bf_test.c binary.c binary.h alloc.c so we can't put any type of defined conditional around the code inside binary.c, i.e., bf_test.c always needs it. Hence, this bin_hook.c accomplishes the defined conditional for gnuplot while leaving the code compiled in binary.o for bf_test. > It doesn't seem to have worked, and anyhow I don't think that is the > proper way to do it. There may be a better way. I didn't put too much effort into a better method because I hoped that eventually gnuplot wouldn't need the code inside binary.c anymore, in which case binary.c could be dedicated simply to the C program for creating binary files (bf_test), and bin_hook.c would get the heav-ho from gnuplot_SOURCES. > The Makefiles produced by ./configure should either > include binary.o, or not, depending on whether BINARY_DATA_FILE was selected. > It should not require any extra source files. I suppose the best thing is that based upon BINARY_DATA_FILE in ./configure, the file binary.c would or wouldn't be present in the list where bin_hook.c is. That is: gnuplot_SOURCES = alloc.c alloc.h ansichek.h axis.c axis.h bin_hook.c \ breaders.c breaders.h bitmap.c bitmap.h color.c color.h command.c \... becomes gnuplot_SOURCES = alloc.c alloc.h ansichek.h axis.c axis.h binary.c \ breaders.c breaders.h bitmap.c bitmap.h color.c color.h command.c \... or gnuplot_SOURCES = alloc.c alloc.h ansichek.h axis.c axis.h \ breaders.c breaders.h bitmap.c bitmap.h color.c color.h command.c \... whichever is appropriate. I don't know how to do that in configure. Dan |