Message-ID: <3952DB31.726CAD4F@pacbell.net> From: Wesel X-Mailer: Mozilla 4.73 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Make file wildcards Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 68 Date: Thu, 22 Jun 2000 20:36:17 -0700 NNTP-Posting-Host: 63.197.122.98 X-Complaints-To: abuse AT pacbell DOT net X-Trace: news.pacbell.net 961731039 63.197.122.98 (Thu, 22 Jun 2000 20:30:39 PDT) NNTP-Posting-Date: Thu, 22 Jun 2000 20:30:39 PDT Organization: SBC Internet Services To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I'm sure this topic has gone around before, and I apologise for not lurking long. I have a question about the format of a makefile I was hoping (praying?) that you might be able to help me with. The makefile suggested by the good people at delorie.com went as follows: -------------------------------------------------------- CC = gcc CFLAGS = -g -O2 OBJECTS = main.o foo.o main.exe : $(OBJECTS) $(CC) $(CFLAGS) $(OBJECTS) -o main.exe %.o : %.c $(CC) $(CFLAGS) -c $< -------------------------------------------------------- The rule that stated %.o : %.c was supposed to happen whenever a file with the extension .c got modified. Taking this knowledge to heart, I proceeded to make a single source file test.cpp. I built my makefile as follows: -------------------------------------------------------- CC = gcc CFLAGS = -g OBJECTS = test.o main.exe : $(OBJECTS) $(CC) $(CFLAGS) $(OBJECTS) -o main.exe %.o : %.c %.cpp %.h $(CC) $(CFLAGS) -c $< -------------------------------------------------------- My hopes were that upon discovering a modified .cpp file, make would compile test.o then, finding a modified (created) test.o file, it would build main.exe from the object file. The makefile compiled fine, but it used a sneaky implicit rule. Apparantly %.o : %.cpp is built-in, so what I saw was -------------------------------------------------------- make -k gpp -c -o test.o test.cpp gcc -g test.o -o main.exe Compilation finished at Thu Jun 22 20:29:34 -------------------------------------------------------- One might notice that the implicit rule generates NO debug information for test.o. When I ran gdb on main.exe, it found no information about line numbers, and couldn't show me the related source code. Upon disabling implicit rules, make returned with an error stating that a rule for test.o was missing. Why didn't "%.o : %.c %.cpp %.h" generate a rule for compiling test.o? Is there any way I can use wildcards with the make utility provided by djgpp? Do I have to write out every rule for every object-source pair I use? I do intend to have more than one source file eventually. Thank you kindly. Wesel -- To send me an email, just replace the @ and the . -----wassdamo at pacbell dot net