z88dk forums

z80 Development Kit

You are not logged in.

#1 2008-04-25 01:16:09

norecess
Member
From: Montreal, Canada
Registered: 2008-03-20
Posts: 73
Website

compile only if .o older than .c .. for zcc

Hi,

z80asm has the nice -d switch which avoids to compile files which do not need to.

Would it be possible to add same feature to zcc C compiler ? that would save me some precious time while compiling smile

Thank you,
Arnaud

Offline

 

#2 2008-04-25 07:25:18

alvin
Administrator
Registered: 2007-07-16
Posts: 338

Re: compile only if .o older than .c .. for zcc

norecess wrote:

z80asm has the nice -d switch which avoids to compile files which do not need to.

Would it be possible to add same feature to zcc C compiler ? that would save me some precious time while compiling smile

Need to save those precious seconds I guess lol

The first thought I have is this task is usually handled by make....

Offline

 

#3 2008-04-25 09:11:53

dom
Administrator
Registered: 2007-07-15
Posts: 738
Website

Re: compile only if .o older than .c .. for zcc

My thoughts are the same as Alvins; that this should be handled by make which can do proper dependency management, here's the makefile I used for zsock:

Code:

TARGET   = +z88
#TARGET   = +cpm


CC       = zcc
CFLAGS   = -vn -DNETSTAT -DINACTIVETO=1200 -make-app -O3  -preserve
INCLUDES = -I. -I../include
LIBS     = -lnetdev -lmalloc
LDFLAGS  = 

SOURCES  := setup.c icmp.c ip.c udp.c tcp.c udp_dom.c  \
        handler_call.c net_utils.c loopback.c pbuf.c socket.c socket_int.c \
        pppset.c slip_dev.c z80.c time.c tcp_int.c ping.c lowlevel2.c device.c

ifeq (+z88,$(TARGET))
        SOURCES +=  config_read.c main.c app.c
        LDFLAGS = -create-app -nt
        LIBS += -lz88
endif

ifeq (+cpm,$(TARGET))
        SOURCES += unixmain.c
endif

ASMS      := $(SOURCES:.c=.opt)

all:    $(ASMS)
        $(CC) $(TARGET) $(LDFLAGS) -o zsock $(CFLAGS) $(ASMS) $(LIBS)



%.opt: %.c zsock.h
        $(CC) $(TARGET) $(CFLAGS) -a $(INCLUDES)  $<


clean:
        rm -f *.opt *~ zsock zsock.62 zsock.63 zcc_opt.def

Note the use of the -preserve flag - this prevents the zcc_opt.def from being deleted between unit compilations.

I'm unsure why I decided to create the final executable from .opt files rather than .o files however.

Offline

 

#4 2008-04-25 17:09:18

norecess
Member
From: Montreal, Canada
Registered: 2008-03-20
Posts: 73
Website

Re: compile only if .o older than .c .. for zcc

Cool, I did the changes using a Make/MAKEFILE and now it works as expected - it only compiles when needed.

Anyway, would be nice for coherency to add that z80asm's -d switch to zcc smile

Thank you,
Arnaud

Offline

 

#5 2008-04-26 08:24:36

alvin
Administrator
Registered: 2007-07-16
Posts: 338

Re: compile only if .o older than .c .. for zcc

norecess wrote:

Anyway, would be nice for coherency to add that z80asm's -d switch to zcc smile

heh heh.  well z80asm's on the way out, although Gerton's probably done the same with mpm.  Not sure why he would do such a thing given make is ubiquitous.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson