delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/16/21:00:46

Xref: news2.mv.net comp.os.msdos.djgpp:6062
From: lehmann AT mathematik DOT th-darmstadt DOT de (Alexander Lehmann)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem Compiling via Make
Date: 16 Jul 1996 23:52:23 GMT
Organization: Technische Hochschule Darmstadt
Lines: 58
Message-ID: <4sh9vn$23ed@rs18.hrz.th-darmstadt.de>
References: <4sh3m5$gj1 AT pirates DOT cs DOT swt DOT edu>
NNTP-Posting-Host: fb0408.mathematik.th-darmstadt.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Bresie (breezy AT dali DOT math DOT swt DOT edu) wrote:
: I hope that I have just not overlooked it in the FAQs or the regular Info, but

: I have just started using djgpp and have made a few programs, which I decided
: would eventually need a makefile to make things easier.

: When I did the, I found that my CFLAGS were not being included (or so I 
: assume) when compiled (they are not displayed; I do not know if they are 
: not displayed to begin with but anyway...)

: Ultimately, the output of the compilation looks something along the lines of:

: gcc -c init.c

: without anything else being displayed.

: Am I missing something? 


: My makefile looks like this:

: # constants
: ALL = main.o init.o inputq.o
: LIB_FLAGS = -L/C/djgpp/LIB -lxlib
: CFLAGS = $(LIB_FLAGS -O2)
Probably CFLAGS = $(LIB_FLAGS) -O2
but you don't need LIB_FLAGS in gcc -c anyway.
: RM = del
: CC = gcc $(CFLAGS)

: # main program
: main.exe:      $(ALL)
: 	$(CC) $(ALL) -o main.exe

: main.o:        main.c main.h consts.h init.h defines.h xlib.h inputq.h
: 	$(CC) -c main.c

: init.o:        init.c consts.h
: 	$(CC) -c init.c

: inputq.o:        inputq.c inputq.h
: 	$(CC) -c inputq.c

: clean:  
: 	$(RM) *.o

Well, the implicit .o.c rule uses a command line something like
$(CC) $(CFLAGS) -o xxx.o -c xxx.c. If you want to use CFLAGS in you
own rules, you have to specify it explicitly.


bye, Alexander

--
Alexander Lehmann,                                  |  "On the Internet,
alex AT hal DOT rhein-main DOT de  (plain, MIME, NeXT)         |   nobody knows
lehmann AT mathematik DOT th-darmstadt DOT de (plain)          |   you're a dog."
!!CHANGED!! <URL:http://www.mathematik.th-darmstadt.de/~lehmann/>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019