From: Mike D. Lowis Date: Thu, 19 Apr 2012 20:45:51 +0000 (-0400) Subject: Added Makefile because ruby is stupid X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=a29b8586e7dbe82eddcb010d799e87f0d847fe33;p=archive%2Fparse-utils.git Added Makefile because ruby is stupid --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..45505b6 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +############################################################################### +# +# Name: Parse Utils +# Type: Library +# Author: Mike Lowis +# License: BSD 2-Clause +# +############################################################################### + +# Project and Artifact Names +#--------------------------- +PROJ_NAME = parseutils +SHARED_NAME = lib$(PROJ_NAME).lib +STATIC_NAME = lib$(PROJ_NAME).a + +# File and Directory Settings +#---------------------------- +SRC_ROOT = source/ +SRC_FTYPE = cpp +SRC_FILES = $(shell find $(SRC_ROOT) -name *.$(SRC_FTYPE) -print) +OBJ_FILES = $(SRC_FILES:%.$(SRC_FTYPE)=%.o) +SRC_DIRS = $(dir $(SRC_FILES)) +INC_DIRS = $(addprefix -I,$(SRC_DIRS)) + +# Compiler and Linker Options +#---------------------------- +CXXFLAGS = $(INC_DIRS) -Wall -fPIC +ARFLAGS = rcs + +# Build Rules +#------------ +all: shared static +shared: $(SHARED_NAME) +static: $(STATIC_NAME) + +$(SHARED_NAME): $(OBJ_FILES) + $(CXX) $(CXX_FLAGS) -shared -o $@ $(OBJ_FILES) + +$(STATIC_NAME): $(OBJ_FILES) + $(AR) $(ARFLAGS) $@ $(OBJ_FILES) + +$(OBJ_FILES): %.o : %.$(SRC_FTYPE) + +clean: + $(RM) -f $(foreach dir,$(SRC_DIRS), $(dir)*.o) + $(RM) -f $(SHARED_NAME) + $(RM) -f $(STATIC_NAME) +