Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Nov 1998 13:05:17 -0600
From:      Stephen Zepp <zenithar@mindspring.com>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Gmake --using seperate directories for .c, .h, and .o files
Message-ID:  <3649DFED.FCD85FCB@mindspring.com>

next in thread | raw e-mail | index | archive | help

I've been trying for several days to write a simple Makefile that can
handle having the .c and .h files in seperate directories, and place
the .o files in a third directory.  The executable is fine in the src
dir.

Paths:
/dsmud
  /src : contains .c, Makefile, and executable
  /inc : contains .h
  /obj : repository for .o files.

gmake is run from /dsmud/src.
I've poured over the online version of the .info of gmake, and as far
as I can tell we are doing what is correct, but we always get the
error:

gmake: *** No rule to make target `act_comm.o', needed by
`darkshade'.  Stop.

It's my understanding that the vpath allows gmake to check the
directories as set in INCDIR, SRCDIR and OBJDIR, but this doesn't seem
to be happening.  We've tried several dozen different forms for the
rules, including removing all rules ( except darkshade and clean )
completely to force the implicits rules to take place, but nothing
seems to work.  We've also tried all the various variables, including
$< $> and $* with no effect.

System is a Pentium 90 running FreeBSD 2.2.7-STABLE

Makefile is below.  Anyone have any suggestions? :)

TIA

Stephen Zepp



CC      = gcc
PROF    = 
NOCRYPT =

#
# Source directories
#

SRCDIR=/usr/home2/dsmain/dsmud/src

INCDIR=/usr/home2/dsmain/dsmud/inc

#
# Target directories
#

OBJDIR=/usr/home2/dsmain/dsmud/obj

.CURDIR=.
# Debugging flags possible:  DEBUG_MEM DEBUG_MEM_CORRUPT
DEBUG_MEM_DUP_FREE
# DEBUG_MEM is most basic, just checks magic numbers when freeing
# DEBUG_MEM_CORRUPT checks every free block to see if magic numbers
ok, every
#                   call to alloc_mem
#		    Also makes calls to void check_free_mem(void) check for
#		    corrupted free memory blocks.
# DEBUG_MEM_DUP_FREE checks to see if freed blocks are overlapping
every call
# 		     to mem_alloc.
#

#  -DDEBUG_MEM -DDEBUG_MEM_CORRUPT -DDEBUG_MEM_DUP_FREE
#-DDEBUG_MEM -DDEBUG_MEM_CORRUPT

CFLAGS = -O -g3 -Wall -DACK_43 $(PROF) $(NOCRYPT) -I. -I$(SRCDIR)
-I$(OBJDIR) -I$(INCDIR) 
#CFLAGS = -g3 -Wall ($PROF) $(NOCRYPT)

L_FLAGS = -O -g $(PROF)
#L_FLAGS = $(PROF)
#VPATH=$(SRCDIR)/:$(INCDIR)/:$(OBJDIR)/
vpath %.c $(SRCDIR)
vpath %.h $(INCDIR)
vpath %.o $(OBJDIR)

OBJS_darkshade = \
	act_comm.o \
	act_info.o \
	act_move.o \
	act_obj.o \
	act_wiz.o \
	comm.o \
	const.o \
	db.o \
	fight.o \
	handler.o \
	interp.o \
	magic.o \
	magic2.o \
	magic3.o \
	magic4.o \
	spell_dam.o \
	mob_commands.o \
	mob_prog.o \
	save.o \
	special.o \
	update.o \
	board.o \
	areasave.o \
	buildtab.o \
	build.o \
	write.o \
	act_clan.o \
	buildare.o \
	hunt.o \
	hash.o \
	areachk.o \
	clutch.o \
	obj_fun.o \
	macros.o \
	trigger.o \
	quest.o \
	lists.o \
	social-edit.o \
	imc.o \
	imc-mercbase.o \
	imc-interp.o \
	imc-version.o \
	imc-mail.o \
	imc-util.o \
	imc-config.o \
	imc-events.o \
	ice.o \
	icec.o \
	icec-mercbase.o \
	vampyre.o \
	werewolf.o \
	mount.o \
	pdelete.o \
	wizutil.o \
	money.o \
	ssm.o \
	scheck.o \
	rulers.o \
	spendqp.o \
	enchant.o \
	sysdata.o \
	strfuns.o \
	mapper.o \
	email.o \
	overland.o \
	file_io.o \
	system.o \
	vr_handler.o \
	guilds.o \
	interact.o \
	craftspec.o

darkshade: $(OBJS_darkshade)
	rm -f darkshade
	$(CC) $(L_FLAGS) -o darkshade $(OBJS_darkshade) -lm -lscrypt

%.o:	%.c
	$(CC) -c $(CFLAGS) $^ -o $@

# %.c:	
#	$(CC) -c $(CFLAGS) $^ -o $@

clean:
	rm -f $(OBJS_darkshade) darkshade ../area/darkshade.core
	make

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3649DFED.FCD85FCB>