#
# LPVM Makefile
#
# LPC Virtual Machine
#
# Requires "gnumake"
#
# $Id: Makefile,v 1.7 2004/06/15 13:36:12 dredd Exp $
#
# $Source: /cvsroot/swlpc/swlpc/lpc/Makefile,v $
# $Revision: 1.7 $
# $Date: 2004/06/15 13:36:12 $
# $State: Exp $
#
# Author: Geoff Wong
# Copyright (C) 1996, 1997 Geoff Wong
# geoff@cs.rmit.edu.au
#
# This Makefile messes up dependency checking (-MM) because
# it's looking for depencies on obj/<sys>/<file>.o instead of <file.o>
# which is how the dependencies are given in .depend
#
include ../swlpc.mk
include ../vsn.mk
# Target Name
TARGET=lpc.so
STARGET=lpc.a
TARGET2=mud.so
STARGET2=mud.a
#
# Some operating system dependent trickery
#
OBJPATH=.
VPATH=$(OBJPATH)
#
# Compiler Stuff
# NB: should really be determined by configure
#
#YACC=byacc
YFLAGS=-v -d
#
# The compiler source code
#
BASE = \
build.c \
lexical.c \
lexer.c \
compile.c \
yyerror.c
SRC = $(BASE) \
lang.c
MSRC = $(BASE) \
mud.c
#
# Define the object code
#
OBJ := $(SRC:%.c=$(OBJPATH)/%.o)
MOBJ := $(MSRC:%.c=$(OBJPATH)/%.o)
#
# Find local headers
#
HDRS := $(shell echo *.h)
$(OBJPATH)/%.o: %.c
$(CC) $(PROF) -c $(CFLAGS) $(DEFS) $(INCLUDE) $< -o $@
all: sdepend $(TARGET) $(TARGET2)
static: sdepend $(STARGET) $(STARGET2)
$(TARGET): $(OBJ)
-mv ../lib/lib$(TARGET).$(VERSION) ../lib/lib$(TARGET).$(VERSION)~
$(CC) $(CFLAGS) -shared $(LDOPTS) -o ../lib/lib$(TARGET).$(VERSION) $(OBJ) $(LIBS)
-rm ../lib/lib$(TARGET)
-ln -s ../lib/lib$(TARGET).$(VERSION) ../lib/lib$(TARGET)
$(STARGET): $(OBJ)
-mv ../lib/lib$(STARGET).$(VERSION) ../lib/lib$(STARGET).$(VERSION)~
$(AR) cr ../lib/lib$(STARGET).$(VERSION) $(OBJ)
-rm ../lib/lib$(STARGET)
-ln -s ../lib/lib$(STARGET).$(VERSION) ../lib/lib$(STARGET)
$(TARGET2): $(MOBJ)
-mv ../lib/lib$(TARGET2).$(VERSION) ../lib/lib$(TARGET2).$(VERSION)~
$(CC) $(CFLAGS) -shared $(LDOPTS) -o ../lib/lib$(TARGET2).$(VERSION) $(MOBJ)
-rm ../lib/lib$(TARGET2)
-ln -s ../lib/lib$(TARGET2).$(VERSION) ../lib/lib$(TARGET2)
$(STARGET2): $(MOBJ)
-mv ../lib/lib$(STARGET2).$(VERSION) ../lib/lib$(STARGET2).$(VERSION)~
$(AR) cr ../lib/lib$(STARGET2).$(VERSION) $(MOBJ)
-rm ../lib/lib$(STARGET2)
-ln -s ../lib/lib$(STARGET2).$(VERSION) ../lib/lib$(STARGET2)
tags: $(SRC)
ctags $(SRC)
lint: $(SRC) $(MSRC)
tlint $(SRC) $(MSRC) > LINT
clean:
-rm -f $(OBJ) $(MOBJ) core y.output
veryclean: clean
-rm -f $(TARGET) $(TARGET2) tags lang.c
# Depend stuff below (do not change!)
sdepend: $(SRC) $(MSRC) $(HDRS)
$(CC) -MM $(DEFS) $(SRC) $(MSRC) $(INCLUDE) > .depend
.PHONY:
-include .depend
%.c: %.y
$(YACC) $(YFLAGS) $<
mv y.tab.c $@