diff options
author | Vincent Sanders <vince@kyllikki.org> | 2013-03-13 21:20:58 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2013-03-13 21:20:58 +0000 |
commit | 1ef631e23888a0356387c4cd5cf4730c4a2fa8fa (patch) | |
tree | f89eddf4720b7e7a5eacfcf3596f5175decc5da1 | |
parent | 97618ed23a10b9866dfece67c194fd6a56ec38f3 (diff) | |
download | librosprite-1ef631e23888a0356387c4cd5cf4730c4a2fa8fa.tar.gz librosprite-1ef631e23888a0356387c4cd5cf4730c4a2fa8fa.tar.bz2 |
move librosprite to core buildsystem
some fixmes exist for unbuilt tools
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 88 | ||||
-rw-r--r-- | examples/example.c (renamed from example.c) | 0 | ||||
-rw-r--r-- | include/librosprite.h (renamed from librosprite.h) | 0 | ||||
-rw-r--r-- | librosprite.pc.in | 2 | ||||
-rw-r--r-- | src/Makefile | 4 | ||||
-rw-r--r-- | src/librosprite.c (renamed from librosprite.c) | 1 | ||||
-rw-r--r-- | src/palette2c.c (renamed from palette2c.c) | 0 |
8 files changed, 42 insertions, 54 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dd07bff --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build-* @@ -1,63 +1,45 @@ -AR = ar -CC = gcc -LD = gcc -DOXYGEN = doxygen -INSTALL = install -SED = sed -MKDIR = mkdir -PKG_CONFIG = pkg-config - -ARFLAGS = -cru -CFLAGS = -g -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ +# Component settings +COMPONENT := rosprite +COMPONENT_VERSION := 0.0.1 +# Default to a static library +COMPONENT_TYPE ?= lib-static + +# FIXME +# palette2c tool needs building and installing as binary target +# examples/example.c needs a build target + +# Setup the tooling +PREFIX ?= /opt/netsurf +NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem +include $(NSSHARED)/makefiles/Makefile.tools + +# Toolchain flags +WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes \ - -Wnested-externs -Werror -pedantic -std=c99 \ + -Wnested-externs -pedantic -std=c99 \ -Wno-format-zero-length -Wformat-security -Wstrict-aliasing=2 \ -Wmissing-format-attribute -Wunused -Wunreachable-code \ -Wformat=2 -Werror-implicit-function-declaration \ -Wmissing-declarations -Wmissing-prototypes -LDFLAGS = -g -L./ -# Installation prefix, if not already defined (e.g. on command line) -PREFIX ?= /usr/local -DESTDIR ?= +# BeOS/Haiku standard library headers create warnings +ifneq ($(TARGET),beos) + WARNFLAGS := $(WARNFLAGS) -Werror +endif -.PHONY: all clean docs install uninstall +CFLAGS := -I$(CURDIR)/include/ $(WARNFLAGS) $(CFLAGS) -all: librosprite.a +ifneq ($(GCCVER),2) + CFLAGS := $(CFLAGS) -std=c99 +else + # __inline__ is a GCCism + CFLAGS := $(CFLAGS) -Dinline="__inline__" +endif -example: librosprite.a example.o - ${LD} -o $@ example.o ${LDFLAGS} \ - $(shell PKG_CONFIG_PATH=.:$(PKG_CONFIG_PATH) $(PKG_CONFIG) --cflags --libs sdl librosprite) +include $(NSBUILD)/Makefile.top -palette2c: librosprite.a palette2c.o - ${LD} -o $@ palette2c.o ${LDFLAGS} \ - $(shell PKG_CONFIG_PATH=.:$(PKG_CONFIG_PATH) $(PKG_CONFIG) --cflags --libs librosprite) - -librosprite.a: librosprite.o librosprite.pc - ${AR} ${ARFLAGS} librosprite.a librosprite.o - -librosprite.pc: librosprite.pc.in - $(SED) -e 's#PREFIX#$(PREFIX)#' librosprite.pc.in > librosprite.pc - -%.o: %.c - ${CC} -c ${CFLAGS} -o $@ $< - -docs: - ${DOXYGEN} - -clean: - rm -f $(wildcard *.o) $(wildcard *.a) example palette2c librosprite.pc - rm -rf doc - -install: librosprite.a librosprite.pc - $(MKDIR) -p $(DESTDIR)$(PREFIX)/lib/pkgconfig - $(MKDIR) -p $(DESTDIR)$(PREFIX)/lib - $(MKDIR) -p $(DESTDIR)$(PREFIX)/include - $(INSTALL) --mode=644 -t $(DESTDIR)$(PREFIX)/lib librosprite.a - $(INSTALL) --mode=644 -t $(DESTDIR)$(PREFIX)/include librosprite.h - $(INSTALL) --mode=644 -t $(DESTDIR)$(PREFIX)/lib/pkgconfig librosprite.pc - -uninstall: - rm $(DESTDIR)$(PREFIX)/lib/librosprite.a - rm $(DESTDIR)$(PREFIX)/include/librosprite.h - rm $(DESTDIR)$(PREFIX)/lib/pkgconfig/librosprite.pc +# Extra installation rules +I := /include +INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/librosprite.h +INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in +INSTALL_ITEMS := $(INSTALL_ITEMS) /lib:$(OUTPUT) diff --git a/example.c b/examples/example.c index 4f9755e..4f9755e 100644 --- a/example.c +++ b/examples/example.c diff --git a/librosprite.h b/include/librosprite.h index f54eaf2..f54eaf2 100644 --- a/librosprite.h +++ b/include/librosprite.h diff --git a/librosprite.pc.in b/librosprite.pc.in index 322ca21..391bc08 100644 --- a/librosprite.pc.in +++ b/librosprite.pc.in @@ -5,6 +5,6 @@ includedir=${prefix}/include Name: librosprite Description: Loads RISC OS sprite files -Version: 0.0.1 +Version: VERSION Libs: -L${libdir} -lrosprite Cflags: -I${includedir} diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..f7c7c7a --- /dev/null +++ b/src/Makefile @@ -0,0 +1,4 @@ +# Sources +DIR_SOURCES := librosprite.c + +include $(NSBUILD)/Makefile.subdir diff --git a/librosprite.c b/src/librosprite.c index 04498fe..9252510 100644 --- a/librosprite.c +++ b/src/librosprite.c @@ -711,6 +711,7 @@ static uint32_t rosprite_palette_lookup(struct rosprite* sprite, uint32_t pixel) translated_pixel = sprite_1bpp_palette[pixel]; break; default: + translated_pixel = 0; assert(false); } } diff --git a/palette2c.c b/src/palette2c.c index bbe272c..bbe272c 100644 --- a/palette2c.c +++ b/src/palette2c.c |