freebsd-ports/devel/glui/files/patch-makefile
Pietro Cerutti b34ca4836a - Build and install shared library as well
Feature safe:	yes
2011-12-01 10:44:52 +00:00

60 lines
1.4 KiB
Text

--- makefile.orig 2007-08-21 05:59:54.000000000 +0200
+++ makefile 2011-12-01 11:36:01.000000000 +0100
@@ -9,12 +9,7 @@
OPTS=-O0
#OPTS=-O2
-UNAME = $(shell uname)
-
-ifeq ($(UNAME), Linux)
-CXX = g++
-CPPFLAGS += $(OPTS) -Wall -pedantic
-endif
+CPPFLAGS = $(CXXFLAGS) -Wall -pedantic -fPIC
#######################################
@@ -35,8 +30,8 @@
# CPPFLAGS += -I/usr/X11R6/include -DGLUI_FREEGLUT
# (3) GLUT
-LIBGLUT = -L/usr/X11R6/lib -lglut
-CPPFLAGS += -I/usr/X11R6/include
+LIBGLUT = -L${LOCALBASE}/lib -lglut
+CPPFLAGS += -I${LOCALBASE}/include
#######################################
@@ -44,13 +39,15 @@
GLUI_LIB = lib/libglui.a
+GLUI_DYNLIB = lib/libglui.so
+
GLUI_EXAMPLES = bin/example1 bin/example2 bin/example3 bin/example4 bin/example5 bin/example6
GLUI_TOOLS = bin/ppm2array
.PHONY: all setup examples tools clean depend doc doc-pdf doc-dist dist
-all: setup $(GLUI_LIB) examples tools
+all: setup $(GLUI_LIB) $(GLUI_DYNLIB) examples tools
setup:
mkdir -p bin
@@ -64,11 +61,14 @@
$(CXX) $(CPPFLAGS) -o $@ $^
bin/%: example/%.cpp $(GLUI_LIB)
- $(CXX) $(CPPFLAGS) -o $@ $< $(LIBGLUI) $(LIBGLUT) $(LIBGL) $(LIBS)
+ $(CXX) $(CPPFLAGS) -o $@ $< $(GLUI_LIB) $(LIBGLUT) $(LIBGL) $(LIBS)
$(GLUI_LIB): $(GLUI_OBJS)
ar -r $(GLUI_LIB) $(GLUI_OBJS)
+$(GLUI_DYNLIB): $(GLUI_OBJS)
+ $(CXX) -shared -o $@ $(GLUI_OBJS) $(LIBGLUT) $(LIBGL) $(LIBS)
+
.cpp.o:
$(CXX) $(CPPFLAGS) -c $<