summaryrefslogtreecommitdiff
path: root/trunk/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/Makefile')
-rw-r--r--trunk/Makefile28
1 files changed, 26 insertions, 2 deletions
diff --git a/trunk/Makefile b/trunk/Makefile
index 0dcabcb..84bd408 100644
--- a/trunk/Makefile
+++ b/trunk/Makefile
@@ -2,6 +2,10 @@ AR = ar
CC = gcc
LD = gcc
DOXYGEN = doxygen
+INSTALL = install
+SED = sed
+MKDIR = mkdir
+
ARFLAGS = -cru
CFLAGS = -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wstrict-prototypes \
@@ -12,6 +16,16 @@ CFLAGS = -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
-Wmissing-declarations -Wmissing-prototypes
LDFLAGS = -L./
+# Installation prefix, if not already defined (e.g. on command line)
+PREFIX ?= /usr/local
+
+.PHONY: all clean docs install
+
+# Installation prefix, if not already defined (e.g. on command line)
+PREFIX ?= /usr/local
+
+.PHONY: all clean docs install
+
all: example palette2c
example: librosprite.a example.o
@@ -30,5 +44,15 @@ docs:
${DOXYGEN}
clean:
- rm -f $(wildcard *.o) $(wildcard *.a) example palette
- rm -rf doc \ No newline at end of file
+ rm -f $(wildcard *.o) $(wildcard *.a) example palette2c librosprite.pc
+ rm -rf doc
+
+install: librosprite.a
+ $(MKDIR) -p $(PREFIX)/lib/pkgconfig
+ $(MKDIR) -p $(PREFIX)/lib
+ $(MKDIR) -p $(PREFIX)/include
+ $(INSTALL) --mode=644 -t $(PREFIX)/lib librosprite.a
+ $(INSTALL) --mode=644 -t $(PREFIX)/include librosprite.h
+ $(SED) -e 's#PREFIX#$(PREFIX)#' librosprite.pc.in > librosprite.pc
+ $(INSTALL) --mode=644 -t $(PREFIX)/lib/pkgconfig librosprite.pc
+