]> git.tdb.fi Git - libs/core.git/commitdiff
First version
authorNiko Liikanen <cloud@neo-midgar.com>
Wed, 23 Aug 2006 22:32:42 +0000 (22:32 +0000)
committerNiko Liikanen <cloud@neo-midgar.com>
Wed, 23 Aug 2006 22:32:42 +0000 (22:32 +0000)
Makefile [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..b88954c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,75 @@
+TMP            = $(HOME)/nightwatch/tmp
+TGT            = $(HOME)/nightwatch
+
+CXX            = g++
+CC             = gcc
+AR             = ar
+CP             = cp
+INCLUDE                = -Isource -I$(TMP)/include
+LIB            = -L$(TMP)
+DEBUG          = 
+CFLAGS         = $(DEBUG) $(INCLUDE) -pipe -Wall `pkg-config --cflags sigc++-2.0` `sdl-config --cflags`
+CXXFLAGS       = $(CFLAGS)
+
+LIBRARY                = framework
+LIBFILE                = libmspframework
+SRC            = source
+LIBOBJS                = $(addprefix $(TMP)/, $(addsuffix .o, $(notdir $(basename $(wildcard $(SRC)/*.cpp)))))
+
+pkgincludedir  = include/msp/$(LIBRARY)
+libdir         = lib
+
+.PHONY: all
+all: $(TMP) $(TMP)/$(LIBFILE).so $(TMP)/$(LIBFILE).a tmpheaders
+
+# Create temp directory
+$(TMP):
+       mkdir -p $@
+
+# Dynamic library
+$(TMP)/$(LIBFILE).so: $(LIBOBJS)
+       echo "Compiling $(notdir $@)"
+       $(CXX) $^ -shared -o $@ $(LIB) $(LIBRARYLIBS)
+
+# Static library
+$(TMP)/$(LIBFILE).a: $(LIBOBJS)
+       echo "Compiling $(notdir $@)"
+       $(AR) rcs $@ $^
+
+# Copy headers to temp
+.PHONY: tmpheaders
+tmpheaders: $(TMP)/$(pkgincludedir)
+       $(CP) $(SRC)/*.h $<
+
+$(TMP)/$(pkgincludedir):
+       mkdir -p $@
+
+# Library object file
+$(TMP)/%.o: $(SRC)/%.cpp $(wildcard $(SRC)/*.h)
+       echo "Compiling $(LIBRARY)/$(notdir $(basename $@))"
+       $(CXX) -fPIC $(CXXFLAGS) -c $< -o $@
+
+# Installs
+.PHONY: install
+install: install_headers install_lib install_staticlib
+
+$(TGT)/$(pkgincludedir):
+       mkdir -p $@
+
+$(TGT)/$(libdir):
+       mkdir -p $@
+
+.PHONY: install_headers
+install_headers: $(TGT)/$(pkgincludedir)
+       echo "Installing $(LIBRARY) headers to $<"
+       $(CP) $(SRC)/*.h $<
+
+.PHONY: install_lib
+install_lib: $(TGT)/$(libdir) $(TMP)/$(LIBFILE).so
+       echo "Installing dynamic library to $<"
+       $(CP) $(TMP)/$(LIBFILE).so $<
+
+.PHONY: install_staticlib
+install_staticlib: $(TGT)/$(libdir) $(TMP)/$(LIBFILE).a
+       echo "Installing static library to $<"
+       $(CP) $(TMP)/$(LIBFILE).a $<