# Makefile

# Set this to point to the prefix directory of your GMP installation.  The GMP
# header files should be located in $(GMP_DIR)/include, and the library files
# ought to be in $(GMP_DIR)/lib.

# GMP is typically installed here...
GMP_DIR := /usr/local

# Unless it came with your distribution, in which case it is probably here.
# GMP_DIR := /usr

# But this is where I keep it on my system.
# GMP_DIR := /package/misc/spf/gmp

# And I haven't a clue where to find it with Cygwin or MinGW or what-have-you.

# Uncomment if you do not have glibc or another implementation of getline().
# It's probably safe to keep this uncommented in any case, since getline.c
# seems to work well.  But if you have problems, comment it out and recompile.

SRC := getline.c

# If you want to rename the final executable, here's your chance.

EXE := pcode-lite

# If your system or build environment so requires, edit the rest of this file.
# For example, you may need to remove the "-Wl," option from $(LIB), below.

SRC += exec_prog.c load_prog.c main.c scan_args.c
SRC += vec/vec_alloc.c vec/vec_allocfit.c vec/vec_cutn.c\
		vec/vec_diffi.c vec/vec_free.c vec/vec_init.c vec/vec_insn.c\
		vec/vec_shift.c vec/vec_trunc.c
OBJ := $(SRC:.c=.o)
HDR := pcode.h version.h getline.h
HDR += vec/vec.h vec/standards.h vec/types.h vec/warn.h
INC := -I$(GMP_DIR)/include
LIB := -L$(GMP_DIR)/lib -Wl,-rpath,$(GMP_DIR)/lib -lgmp

all: $(EXE)

%.o: %.c $(HDR)
	$(CC) -c -o $@ $< $(INC) $(CFLAGS)

$(EXE): $(OBJ)
	$(CC) -o $@ $^ $(LIB) $(LDFLAGS)

clean:
	-$(RM) -f $(OBJ) $(EXE)

.PHONY: all clean

# vim: set ts=4 sts=4 sw=4 tw=80 noet:
