gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dependency tracking within gm2


From: Gaius Mulley
Subject: dependency tracking within gm2
Date: Tue, 17 Oct 2023 14:35:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hello,

I've just git pushed changes onto the master branch of gcc which
implement the -M* options in gm2.  (-M, -MM, -MD, -MMD, -MF, -MT, -MQ
and -MP).

   https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html

The options control the generation of dependencies which can
be integrated into make.  Below is an example of using these options
with autoconf/make.   I'm sure the example could be improved but it
demonstrates the dependency creation.

Any change to a def file (DrawL.def for example) will trigger the
appropriate recompilation of other implementation modules

hope this is useful,

regards,
Gaius



------ cut here------ cut here------ cut here------ cut here------ 

       
SUFFIXES = .c .mod .def .d .o

DEPFLAGS=-MMD -MT $@ -MP -MF .deps/$*.d

DEPS = AdvCmd.o \
       AdvIntroduction.o \
       AdvMap.o \
       AdvMath.o \
       AdvSound.o \
       AdvSystem.o \
       AdvTreasure.o \
       AdvUtil.o \
       AdvParse.o \
       DrawG.o \
       DrawL.o \
       Lock.o \
       ProcArgs.o \
       Screen.o \
       Window.o \
       SocketControl.o \
       advflex.o

# OPT=-O0 -fm2-g -g -flto
OPT=-O0
CHECK=-fsoft-check-all
DEBUG=-fm2-g -g -Wuninit-variable-checking
M2FLAGS=$(OPT) $(CHECK) $(DEBUG) -fextended-opaque -fgen-module-list=-

BUILT_SOURCES = advflex.c
bin_PROGRAMS = ptower
ptower_SOURCES = AdvCmd.mod \
       AdvIntroduction.mod \
       AdvMap.mod \
       AdvMath.mod \
       AdvSound.mod \
       AdvSystem.mod \
       AdvTreasure.mod \
       AdvUtil.mod \
       AdvParse.mod \
       DrawG.mod \
       DrawL.mod \
       Lock.mod \
       ProcArgs.mod \
       Screen.mod \
       Window.mod \
       SocketControl.c \
       advflex.c

ptower_LDADD = advflex.o SocketControl.o

ptower$(EXEEXT): $(DEPS)
        gm2 $(M2FLAGS) -I. -I$(srcdir) $(srcdir)/Dungeon.mod $(DEPS) -o $@

advflex.c: $(srcdir)/adv.flex
        flex -t $< > $@

# $(srcdir)/AdvParse.mod: $(srcdir)/AdvParse.bnf

.deps: ; @mkdir -p $@

%.o: %.mod .deps/%.d
        @test -z .deps || mkdir -p .deps
        gm2 $(DEPFLAGS) $(M2FLAGS) -I. -I$(srcdir) -c $<

.c.o:
        gcc -c -O0 -g $<

DEPFILES=$(ptower_SOURCES:%.mod=.deps/%.d)

$(DEPFILES):

include $(wildcard $(DEPFILES))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]