Hello
I am trying to use Gnu make on cygwin.
I put together the following based on fragments I found in the pdf manual.
=============first attempt==================================
CC = g++
sources := $(wildcard *.cpp)
objects := $(patsubst %.cpp, %.o, $(sources))
objs: $(Objects)
.PHONY: objs
%.d: %.cpp
$(CC) -MM $(CPPFLAGS) $< > $...@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $...@.$$$$ > $@; \
rm -f $...@.$$$$
%.o: %.cpp
$(CC) -c %.cpp
include $(sources:.c=.d)
=============================end==========================
I wanted this first attempt to just compile each of the compilation units to
their respective object file.
With both GNU Make 3.80 and 3.81, I get the error ‘multiple target patterns.
Stop.’ From the searching on the web, it seems this is a well known problem
with GNU Make on Cygwin, but contrary to the info I found in my search, it
happens with both 3.80 and 3.81.
I constructed my sources and objects from the following, which I found in
the manual (I just made it in two steps rather than one):
> objects := $(patsubst %.c,%.o,$(wildcard *.c))
>
The %d rule I copied directly from the manual:
> Here is the pattern rule to generate a file of prerequisites (i.e., a
> makefile) called ‘name.d’
> from a C source file called ‘name.c’:
> %.d: %.c
> $(CC) -M $(CPPFLAGS) $< > $...@.$$$$; \
> sed ’s,\($*\)\.o[ :]*,\1.o $@ : ,g’ < $...@.$$$$ > $@; \
> rm -f $...@.$$$$
>
I have not yet tried to figure out how to have a makefile work with code
organized into subdirectories (e.g. include, lib1, lib2, app, &c.).
Any help would be appreciated.
Thanks
Ted
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make