bruce.lab...@autoliv.com writes: > > There are two files that need to be compiled with gcc, and five with g++. > > One could set up two objects lists, > > OBJ1=file1.o file2.o <== use gcc > OBJ2=file3.o file4.o file5.o file6.o file7.o <== use g++ > SRC1=file1.c file2.c > SRC2=file3.cpp file4.cpp file5.cpp file6.cpp file7.cpp > CXX=g++ > CC=gcc > CCOPTS= > INCLUDES= > DEPS= > > I'm trying, quite unsucessfully, I may add, to design a rule that compiles > things appropriately. > > Might this work? > > project: $(OBJS1) $(OBJ2) > $(CXX) -o project $(OBJ1) $(OBJ2) $(LIBS) > > $(OBJ1): $(SRC1) $(DEPS) > $(CC) -c $< $(CCOPTS) $(INCLUDES) > > $(OBJ2): $(SRC2) $(DEPS) > $(CXX) -c $< $(CCOPTS) $(INCLUDES)
I'm a big fan of the GNU Autotools (Automake, Autoconf, Libtool); doing it that way, you'd have something like the following two files (which you can drop into the directory with your code, and then initialise by running "autoreconf --install"):
# This is Makefile.am: bin_PROGRAMS = project project_SOURCES = file1.c file2.c \ file3.cpp file4.cpp file5.cpp file6.cpp file7.cpp # (NOTE: project_SOURCES should also include # any corresponding header-files) project_LDADD = -lfftw3 # ... since I hear you're using that...
# This is configure.ac (usually drafted by running "autoscan"): AC_PREREQ([2.59]) AC_INIT([bl-project], [0.1], [bruce.lab...@autoliv.com]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) LT_INIT AC_PROG_CC AC_PROG_CXX AC_CONFIG_SRCDIR([1.c]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT
_______________________________________________ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/