]> git.mdlowis.com Git - archive/parse-utils.git/commitdiff
Added Makefile because ruby is stupid
authorMike D. Lowis <mike@mdlowis.com>
Thu, 19 Apr 2012 20:45:51 +0000 (16:45 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Thu, 19 Apr 2012 20:45:51 +0000 (16:45 -0400)
Makefile [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
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)
+