delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/24/16:02:05

From: Michal Mertl <xmerm05 AT manes DOT vse DOT cz>
Newsgroups: comp.os.msdos.djgpp
Subject: makefile problem
Date: Fri, 24 Oct 1997 14:40:44 +0200
Organization: Prague University of Economics
Lines: 84
Message-ID: <Pine.ULT.3.95.971024143516.27217A-100000@manes.vse.cz>
NNTP-Posting-Host: manes.vse.cz
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have the following direcory structure:
c:\pmode\makefile
c:\pmode\pmlite.c
c:\pmode\pmpro.c
c:\pmode\pmpro.i
c:\pmode\pmpro.o
c:\pmode\vflat.c
c:\pmode\_pmlite.asm
c:\pmode\_pmpro.asm
c:\pmode\_vflat.asm
c:\pmode\TEST\altbrk.c
c:\pmode\TEST\altcrit.c
c:\pmode\TEST\biosptr.c
c:\pmode\TEST\brk.c
c:\pmode\TEST\callreal.c
c:\pmode\TEST\critical.c
c:\pmode\TEST\int10.c
c:\pmode\TEST\isvesa.c
c:\pmode\TEST\key.c
c:\pmode\TEST\key15.c
c:\pmode\TEST\memtest.c
c:\pmode\TEST\mouse.c
c:\pmode\TEST\tick.c
c:\pmode\TEST\vftest.c
c:\pmode\TEST\video.c
c:\pmode\INCLUDE\debug.h
c:\pmode\INCLUDE\model.mac
c:\pmode\INCLUDE\pmode.h
c:\pmode\INCLUDE\pmpro.h

and the following makefile:

ASMOBJS = _pmpro.o _pmlite.o _vflat.o
COBJS = pmpro.o pmlite.o vflat.o
TESTNAMES = altbrk.o altcrit.o biosptr.o brk.o callreal.o critical.o int10.o \
	isvesa.o key.o key15.o memtest.o mouse.o tick.o vftest.o video.o

LIBOBJS = $(addprefix obj/,$(ASMOBJS) $(COBJS))
TESTS = $(patsubst %.o,%.exe,$(TESTNAMES))
TESTEXES = $(addprefix test/,$(TESTS))
TESTOBJS = $(addprefix obj/,$(TESTNAMES))

CFLAGS = -Wall -g -IInclude
LDFLAGS = -s
TASMFLAGS = -t -mx -DDJGPP -D__FLAT__ -iinclude
LIBRARY = libpmode.a
.PHONY : all library tests clean

all: tests library 

library: $(LIBRARY)

$(LIBRARY): $(LIBOBJS)
	ar rs $(LIBRARY) $(LIBOBJS)

tests: $(LIBRARY) $(TESTEXES)

clean: 
	rm -f $(LIBOBJS)
	rm -f libpmode.a
	rm -f $(TESTOBJS)
	rm -f $(TESTEXES)

obj/%.o: %.asm
	tasm $(TASMFLAGS) $^
	obj2bfd -u -o $@ $(subst .asm,.obj,$^)
	rm -f $(subst .asm,.obj,$^) 

obj/%.o: test/%.c
	gcc $(CFLAGS) -c $^ -o $@

obj/%.o: %.c
	gcc $(CFLAGS) -c $^ -o $@

test/%.exe: obj/%.o
	gcc $(LDFLAGS) -o $@ $^ $(LIBRARY)

When I run make it compiles everything and then executes rm -f $(TESTOBJS).
Why is that ?

Michal "MiMe" Mertl
  xmerm05 AT vse DOT cz


- Raw text -


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