summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-03-29 01:30:16 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-03-29 01:30:16 +0000
commit0b32a222231826bc894557c322f1f1b908103e3c (patch)
treed2466b83e46e3d093f2ab714668b8f9a9a90e477
parent97605136e418460d34df2f05b93d7281927eafb5 (diff)
downloadlibnsbmp-0b32a222231826bc894557c322f1f1b908103e3c.tar.gz
libnsbmp-0b32a222231826bc894557c322f1f1b908103e3c.tar.bz2
First cut at a port to the new buildsystem
svn path=/trunk/libnsbmp/; revision=6981
-rw-r--r--Makefile116
-rw-r--r--include/libnsbmp.h (renamed from libnsbmp.h)25
-rw-r--r--src/Makefile4
-rw-r--r--src/libnsbmp.c (renamed from libnsbmp.c)4
-rw-r--r--src/utils/log.h (renamed from utils/log.h)0
5 files changed, 36 insertions, 113 deletions
diff --git a/Makefile b/Makefile
index f720120..53d214b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,95 +1,21 @@
-#
-# This file is part of Libnsbmp
-#
-
-SOURCE = libnsbmp.c
-HDRS = libnsbmp.h utils/log.h
-
-CFLAGS = -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
- -Wwrite-strings -Wstrict-prototypes \
- -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
-ARFLAGS = -cr
-INSTALL = install
-SED = sed
-DOXYGEN = doxygen
-
-ifeq ($(TARGET),riscos)
- GCCSDK_INSTALL_CROSSBIN ?= /home/riscos/cross/bin
- GCCSDK_INSTALL_ENV ?= /home/riscos/env
- CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
- AR := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*ar)
- CFLAGS += -Driscos -mpoke-function-name -I$(GCCSDK_INSTALL_ENV)/include
- LIBS = -L$(GCCSDK_INSTALL_ENV)/lib
- ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC)))
- EXEEXT := ,e1f
- SUBTARGET := -elf-
- else
- EXEEXT := ,ff8
- SUBTARGET := -aof-
- endif
- PREFIX = $(GCCSDK_INSTALL_ENV)
-else
- CFLAGS += -g
- LIBS =
- PREFIX = /usr/local
-endif
-
--include Makefile.config
-
-OBJDIR = build-$(TARGET)$(SUBTARGET)objects
-LIBDIR = build-$(TARGET)$(SUBTARGET)lib
-BINDIR = build-$(TARGET)$(SUBTARGET)bin
-
-OBJS = $(addprefix $(OBJDIR)/, $(SOURCE:.c=.o))
-
-.PHONY: all clean docs install uninstall
-
-all: $(LIBDIR)/libnsbmp.a $(BINDIR)/decode_bmp$(EXEEXT) $(BINDIR)/decode_ico$(EXEEXT)
-
-$(LIBDIR)/libnsbmp.a: $(OBJS) $(LIBDIR)/libnsbmp.pc
- @echo " LINK:" $@
- @mkdir -p $(LIBDIR)
- @$(AR) $(ARFLAGS) $@ $(OBJS)
-
-$(LIBDIR)/libnsbmp.pc: libnsbmp.pc.in
- @echo " SED:" $@
- @mkdir -p $(LIBDIR)
- @$(SED) -e 's#PREFIX#$(PREFIX)#' $^ > $@
-
-$(BINDIR)/decode_bmp$(EXEEXT): examples/decode_bmp.c $(LIBDIR)/libnsbmp.a
- @echo " LINK:" $@
- @mkdir -p $(BINDIR)
- @$(CC) $(CFLAGS) -I. -o $@ $^
-
-$(BINDIR)/decode_ico$(EXEEXT): examples/decode_ico.c $(LIBDIR)/libnsbmp.a
- @echo " LINK:" $@
- @mkdir -p $(BINDIR)
- @$(CC) $(CFLAGS) -I. -o $@ $^
-
-$(OBJDIR)/%.o: %.c $(HDRS)
- @echo " COMPILE:" $<
- @mkdir -p $(OBJDIR)
- @$(CC) $(CFLAGS) -c -o $@ $<
-
-docs:
- ${DOXYGEN}
-
-install: $(LIBDIR)/libnsbmp.a $(LIBDIR)/libnsbmp.pc
- mkdir -p $(DESTDIR)$(PREFIX)/lib/pkgconfig
- mkdir -p $(DESTDIR)$(PREFIX)/lib
- mkdir -p $(DESTDIR)$(PREFIX)/include
- $(INSTALL) -m 644 $(LIBDIR)/libnsbmp.a $(DESTDIR)$(PREFIX)/lib
- $(INSTALL) -m 644 libnsbmp.h $(DESTDIR)$(PREFIX)/include
- $(INSTALL) -m 644 $(LIBDIR)/libnsbmp.pc $(DESTDIR)$(PREFIX)/lib/pkgconfig
-
-uninstall:
- rm $(DESTDIR)$(PREFIX)/lib/libnsbmp.a
- rm $(DESTDIR)$(PREFIX)/include/libnsbmp.h
- rm $(DESTDIR)$(PREFIX)/lib/pkgconfig/libnsbmp.pc
-
-clean:
- -rm -rf $(OBJDIR) $(LIBDIR) $(BINDIR) doc
+# Component settings
+COMPONENT := nsbmp
+# Default to a static library
+COMPONENT_TYPE ?= lib-static
+
+# Setup the tooling
+include build/makefiles/Makefile.tools
+
+# Toolchain flags
+WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \
+ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+ -Wmissing-declarations -Wnested-externs -Werror -pedantic
+CFLAGS := $(CFLAGS) -std=c99 -D_BSD_SOURCE -I$(CURDIR)/include/ \
+ -I$(CURDIR)/src $(WARNFLAGS)
+
+include build/makefiles/Makefile.top
+
+# Extra installation rules
+INSTALL_ITEMS := $(INSTALL_ITEMS) /include:include/libnsbmp.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in
+INSTALL_ITEMS := $(INSTALL_ITEMS) /lib:$(BUILDDIR)/lib$(COMPONENT)$(LIBEXT)
diff --git a/libnsbmp.h b/include/libnsbmp.h
index 4bdda23..1ccf820 100644
--- a/libnsbmp.h
+++ b/include/libnsbmp.h
@@ -1,28 +1,18 @@
/*
- * Copyright 2006 Richard Wilson <info@tinct.net>
+ * Copyright 2006 Richard Wilson <richard.wilson@netsurf-browser.org>
* Copyright 2008 Sean Fox <dyntryx@gmail.com>
*
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * This file is part of NetSurf's libnsbmp, http://www.netsurf-browser.org/
+ * Licenced under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
*/
/** \file
* BMP file decoding (interface).
*/
-#ifndef _NETSURF_IMAGE_BMPREAD_H_
-#define _NETSURF_IMAGE_BMPREAD_H_
+#ifndef libnsbmp_h_
+#define libnsbmp_h_
#include <stdbool.h>
#include <stdint.h>
@@ -110,7 +100,8 @@ typedef struct ico_collection {
} ico_collection;
void bmp_create(bmp_image *gif, bmp_bitmap_callback_vt *bitmap_callbacks);
-void ico_collection_create(ico_collection *ico, bmp_bitmap_callback_vt *bitmap_callbacks);
+void ico_collection_create(ico_collection *ico,
+ bmp_bitmap_callback_vt *bitmap_callbacks);
bmp_result bmp_analyse(bmp_image *bmp, size_t size, uint8_t *data);
bmp_result bmp_decode(bmp_image *bmp);
bmp_result bmp_decode_trans(bmp_image *bmp, uint32_t transparent_colour);
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..c46200b
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,4 @@
+# Sources
+DIR_SOURCES := libnsbmp.c
+
+include build/makefiles/Makefile.subdir
diff --git a/libnsbmp.c b/src/libnsbmp.c
index 6101e07..7d1a81c 100644
--- a/libnsbmp.c
+++ b/src/libnsbmp.c
@@ -13,7 +13,9 @@
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
-#include "libnsbmp.h"
+
+#include <libnsbmp.h>
+
#include "utils/log.h"
/* The functions provided by this file allow for the decoding of
diff --git a/utils/log.h b/src/utils/log.h
index b63f084..b63f084 100644
--- a/utils/log.h
+++ b/src/utils/log.h