Howdy all! In working on the freeware netCDF package (used by meteorologists and Earth scientists), I have a bit of a challenge.
Depending on a configure time decision by the user, I build my library in one of two ways. If I configure with --enable-netcdf-4, then I build the old library as a noinst, and then go to another directory and build a library that includes .o files from another directory. I do it like this: # This is the directory where the netcdf-3 object files are. NC3_DIR = $(top_srcdir)/libsrc # Netcdf-4 source. libnetcdf_a_SOURCES = nc4attr.c nc4internal.c nc4var.c netcdf3.h \ nc4dim.c nc4internal.h ncfunc.c netcdf4.h nc4file.c netcdf.h nc4hdf.c \ error.c error.h nc4internal.h nclibstruct.h netcdf3.h netcdf.h \ nc4grp.c # Netcdf-3 object files. libnetcdf_a_LIBADD = $(NC3_DIR)/attr.o $(NC3_DIR)/dim.o \ $(NC3_DIR)/error.o $(NC3_DIR)/libvers.o $(NC3_DIR)/nc.o \ $(NC3_DIR)/ncio.o $(NC3_DIR)/ncx.o $(NC3_DIR)/putget.o \ $(NC3_DIR)/string.o $(NC3_DIR)/v1hpg.o $(NC3_DIR)/v2i.o \ $(NC3_DIR)/var.o $(NC3_DIR)/v2i.o # The netcdf-3 objects have to be explictly added as depedencies to # trigger recompile of netcdf-4 libnetcdf.a if netcdf-3 code changes. libnetcdf_a_DEPENDENCIES = $(NC3_DIR)/attr.o $(NC3_DIR)/dim.o \ $(NC3_DIR)/error.o $(NC3_DIR)/libvers.o $(NC3_DIR)/nc.o \ $(NC3_DIR)/ncio.o $(NC3_DIR)/ncx.o $(NC3_DIR)/putget.o \ $(NC3_DIR)/string.o $(NC3_DIR)/v1hpg.o $(NC3_DIR)/v2i.o \ $(NC3_DIR)/var.o $(NC3_DIR)/v2i.o Is there a better way to do this? Ideally, I would just like to be able to specify a .c file in another directory as part of the library. For example, something like this: linnetcdf_a_SOURCES = nc4attr.c $(NC3_DIR)/attr.c But then I try that, I get errors during the build relating to the automatic dependency tracking. Is there a good solution to this problem? Thanks! Ed -- Ed Hartnett -- [EMAIL PROTECTED]