-LIBRARY = path
-LIBFILE = libmsppath
+NAME = path
-TMP = $(HOME)/nightwatch/tmp
-TGT = $(HOME)/nightwatch
+WORKDIR = $(PWD)/../..
+TMP = $(WORKDIR)/tmp/linux
+TGT = $(HOME)/local
CXX = g++
CC = gcc
AR = ar
CP = cp
+LIBFILE = libmsp$(NAME)
+
+MAKEFLAGS += -s --no-print-directory
INCLUDE = -Isource -I$(TMP)/include
LIB = -L$(TMP)
DEBUG =
-CFLAGS = $(DEBUG) $(INCLUDE) -pipe -Wall
+CFLAGS = $(DEBUG) $(INCLUDE) -pipe -Wall
CXXFLAGS = $(CFLAGS)
-MAKEFLAGS += -s --no-print-directory
PIC = -fPIC
SHARED = .so
STATIC = .a
SRC = source
-LIBOBJS = $(addprefix $(TMP)/, $(addsuffix .o, $(notdir $(basename $(wildcard $(SRC)/*.cpp)))))
+OBJS = $(addprefix $(TMP)/, $(addsuffix .o, $(notdir $(basename $(wildcard $(SRC)/*.cpp)))))
-pkgincludedir = include/msp/$(LIBRARY)
+pkgincludedir = include/msp/$(NAME)
libdir = lib
.PHONY: all
mkdir -p $@
# Dynamic library
-$(TMP)/$(LIBFILE)$(SHARED): $(LIBOBJS)
+$(TMP)/$(LIBFILE)$(SHARED): $(OBJS)
echo "Compiling $(notdir $@)"
$(CXX) $^ -shared -o $@ $(LIB)
# Static library
-$(TMP)/$(LIBFILE)$(STATIC): $(LIBOBJS)
+$(TMP)/$(LIBFILE)$(STATIC): $(OBJS)
echo "Compiling $(notdir $@)"
$(AR) rcs $@ $^
# Library object file
$(TMP)/%.o: $(SRC)/%.cpp $(wildcard $(SRC)/*.h)
- echo "Compiling $(LIBRARY)/$(notdir $(basename $@))"
+ echo "Compiling $(NAME)/$(notdir $(basename $@))"
$(CXX) $(PIC) $(CXXFLAGS) -c $< -o $@
# Installs
.PHONY: install
-install: install_lib
+install: install_lib
$(TGT)/$(pkgincludedir):
mkdir -p $@
.PHONY: install_headers
install_headers: $(TGT)/$(pkgincludedir)
- echo "Installing $(LIBRARY) headers to $<"
+ echo "Installing $(NAME) headers to $<"
$(CP) $(SRC)/*.h $<
.PHONY: install_lib