1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 09:38:28 +03:00
mal/impls/cpp/Makefile
Joel Martin 8a19f60386 Move implementations into impls/ dir
- Reorder README to have implementation list after "learning tool"
  bullet.

- This also moves tests/ and libs/ into impls. It would be preferrable
  to have these directories at the top level.  However, this causes
  difficulties with the wasm implementations which need pre-open
  directories and have trouble with paths starting with "../../". So
  in lieu of that, symlink those directories to the top-level.

- Move the run_argv_test.sh script into the tests directory for
  general hygiene.
2020-02-10 23:50:16 -06:00

55 lines
978 B
Makefile

uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifeq ($(uname_S),Darwin)
# Native build on yosemite. Requires: brew install readline
CXX=g++
READLINE=/usr/local/opt/readline
INCPATHS=-I$(READLINE)/include
LIBPATHS=-L$(READLINE)/lib
else
# Ubuntu 14.10 / docker
CXX=g++-4.9
endif
LD=$(CXX)
AR=ar
DEBUG=-ggdb
CXXFLAGS=-O3 -Wall $(DEBUG) $(INCPATHS) -std=c++11
LDFLAGS=-O3 $(DEBUG) $(LIBPATHS) -L. -lreadline -lhistory
LIBSOURCES=Core.cpp Environment.cpp Reader.cpp ReadLine.cpp String.cpp \
Types.cpp Validation.cpp
LIBOBJS=$(LIBSOURCES:%.cpp=%.o)
MAINS=$(wildcard step*.cpp)
TARGETS=$(MAINS:%.cpp=%)
.PHONY: all clean
.SUFFIXES: .cpp .o
all: $(TARGETS)
dist: mal
mal: stepA_mal
cp $< $@
.deps: *.cpp *.h
$(CXX) $(CXXFLAGS) -MM *.cpp > .deps
$(TARGETS): %: %.o libmal.a
$(LD) $^ -o $@ $(LDFLAGS)
libmal.a: $(LIBOBJS)
$(AR) rcs $@ $^
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -rf *.o $(TARGETS) libmal.a .deps mal
-include .deps