diff --git a/Makefile b/Makefile deleted file mode 100644 index a9fdc663..00000000 --- a/Makefile +++ /dev/null @@ -1,246 +0,0 @@ -# Variables: -prefix = /usr/local -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib -includedir = $(prefix)/include -pkgconfigdir = $(libdir)/pkgconfig - -CFLAGS = -Wall -Wextra -LDFLAGS_GCSECTIONS = -Wl,--gc-sections -LDFLAGS += $(if $(gc_sections-pass),$(LDFLAGS_GCSECTIONS)) -LDLIBS = -lm - -GIT_ARCHIVE = git archive --prefix="$(PACKAGE)/" -9 -INSTALL = install -INSTALL_DATA = $(INSTALL) -m 644 -INSTALL_PROGRAM = $(INSTALL) -m 755 -QMAKE = qmake -MKDIR = mkdir -p -RMDIR = rmdir -SED = sed - -# Our sources -TINYCBOR_HEADERS = src/cbor.h src/cborjson.h src/tinycbor-version.h src/tinycbor-export.h -TINYCBOR_FREESTANDING_SOURCES = \ - src/cborerrorstrings.c \ - src/cborencoder.c \ - src/cborencoder_close_container_checked.c \ - src/cborencoder_float.c \ - src/cborparser.c \ - src/cborparser_float.c \ - src/cborpretty.c \ -# -CBORDUMP_SOURCES = tools/cbordump/cbordump.c - -BUILD_SHARED = $(shell file -L /bin/sh 2>/dev/null | grep -q ELF && echo 1) -BUILD_STATIC = 1 - -ifneq ($(BUILD_STATIC),1) -ifneq ($(BUILD_SHARED),1) - $(error error: BUILD_STATIC and BUILD_SHARED can not be both disabled) -endif -endif - -INSTALL_TARGETS += $(bindir)/cbordump -ifeq ($(BUILD_SHARED),1) -BINLIBRARY=lib/libtinycbor.so -INSTALL_TARGETS += $(libdir)/libtinycbor.so.$(VERSION) -endif -ifeq ($(BUILD_STATIC),1) -BINLIBRARY=lib/libtinycbor.a -INSTALL_TARGETS += $(libdir)/libtinycbor.a -endif -INSTALL_TARGETS += $(pkgconfigdir)/tinycbor.pc -INSTALL_TARGETS += $(TINYCBOR_HEADERS:src/%=$(includedir)/tinycbor/%) - -# setup VPATH -MAKEFILE := $(lastword $(MAKEFILE_LIST)) -SRCDIR := $(dir $(MAKEFILE)) -VPATH = $(SRCDIR):$(SRCDIR)/src - -# Our version -GIT_DIR := $(strip $(shell git -C $(SRCDIR). rev-parse --git-dir 2> /dev/null)) -VERSION = $(shell cat $(SRCDIR)VERSION) -SOVERSION = $(shell cut -f1-2 -d. $(SRCDIR)VERSION) -PACKAGE = tinycbor-$(VERSION) - --include .config - -ifeq ($(wildcard .config),) - $(info .config file not yet created) -endif - -ifeq ($(freestanding-pass),1) -TINYCBOR_SOURCES = $(TINYCBOR_FREESTANDING_SOURCES) -else -TINYCBOR_SOURCES = \ - $(TINYCBOR_FREESTANDING_SOURCES) \ - src/cborparser_dup_string.c \ - src/cborpretty_stdio.c \ - src/cbortojson.c \ - src/cborvalidation.c \ -# -# if open_memstream is unavailable on the system, try to implement our own -# version using funopen or fopencookie -ifeq ($(open_memstream-pass),) - ifeq ($(funopen-pass)$(fopencookie-pass),) - CFLAGS += -DWITHOUT_OPEN_MEMSTREAM - ifeq ($(wildcard .config),.config) - $(warning warning: funopen and fopencookie unavailable, open_memstream can not be implemented and conversion to JSON will not work properly!) - endif - else - TINYCBOR_SOURCES += src/open_memstream.c - endif -endif -endif - -# json2cbor depends on an external library (cjson) -ifneq ($(cjson-pass)$(system-cjson-pass),) - JSON2CBOR_SOURCES = tools/json2cbor/json2cbor.c - INSTALL_TARGETS += $(bindir)/json2cbor - ifeq ($(system-cjson-pass),1) - LDFLAGS_CJSON = -lcjson - else - JSON2CBOR_SOURCES += src/cjson/cJSON.c - json2cbor_CCFLAGS = -I$(SRCDIR)src/cjson - endif -endif - -# Rules -all: .config \ - $(if $(subst 0,,$(BUILD_STATIC)),lib/libtinycbor.a) \ - $(if $(subst 0,,$(BUILD_SHARED)),lib/libtinycbor.so) \ - $(if $(freestanding-pass),,bin/cbordump) \ - tinycbor.pc -all: $(if $(JSON2CBOR_SOURCES),bin/json2cbor) -check: tests/Makefile | $(BINLIBRARY) - $(MAKE) -C tests check -silentcheck: | $(BINLIBRARY) - TESTARGS=-silent $(MAKE) -f $(MAKEFILE) -s check -configure: .config -.config: Makefile.configure - $(MAKE) -f $(SRCDIR)Makefile.configure OUT='$@' configure - -lib/libtinycbor-freestanding.a: $(TINYCBOR_FREESTANDING_SOURCES:.c=.o) - @$(MKDIR) -p lib - $(AR) cqs $@ $^ - -lib/libtinycbor.a: $(TINYCBOR_SOURCES:.c=.o) - @$(MKDIR) -p lib - $(AR) cqs $@ $^ - -lib/libtinycbor.so: $(TINYCBOR_SOURCES:.c=.pic.o) - @$(MKDIR) -p lib - $(CC) -shared -Wl,-soname,libtinycbor.so.$(SOVERSION) -o lib/libtinycbor.so.$(VERSION) $(LDFLAGS) $^ $(LDLIBS) - cd lib ; ln -sf libtinycbor.so.$(VERSION) libtinycbor.so ; ln -sf libtinycbor.so.$(VERSION) libtinycbor.so.$(SOVERSION) - -bin/cbordump: $(CBORDUMP_SOURCES:.c=.o) $(BINLIBRARY) - @$(MKDIR) -p bin - $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) - -bin/json2cbor: $(JSON2CBOR_SOURCES:.c=.o) $(BINLIBRARY) - @$(MKDIR) -p bin - $(CC) -o $@ $(LDFLAGS) $^ $(LDFLAGS_CJSON) $(LDLIBS) - -src/tinycbor-export.h: src/tinycbor-export.h.in - cp $< $@ - -tinycbor.pc: tinycbor.pc.in - $(SED) > $@ < $< \ - -e 's,@prefix@,$(prefix),' \ - -e 's,@exec_prefix@,$(exec_prefix),' \ - -e 's,@libdir@,$(libdir),' \ - -e 's,@includedir@,$(includedir),' \ - -e 's,@version@,$(VERSION),' - -tests/Makefile: tests/tests.pro - $(QMAKE) $(QMAKEFLAGS) -o $@ $< - -$(PACKAGE).tar.gz: | .git - GIT_DIR=$(SRCDIR).git $(GIT_ARCHIVE) --format=tar.gz -o "$(PACKAGE).tar.gz" HEAD -$(PACKAGE).zip: | .git - GIT_DIR=$(SRCDIR).git $(GIT_ARCHIVE) --format=zip -o "$(PACKAGE).zip" HEAD - -$(DESTDIR)$(libdir)/%: lib/% - $(INSTALL) -d $(@D) - $(INSTALL_DATA) $< $@ -$(DESTDIR)$(bindir)/%: bin/% - $(INSTALL) -d $(@D) - $(INSTALL_PROGRAM) $< $@ -$(DESTDIR)$(pkgconfigdir)/%: % - $(INSTALL) -d $(@D) - $(INSTALL_DATA) $< $@ -$(DESTDIR)$(includedir)/tinycbor/%: src/% - $(INSTALL) -d $(@D) - $(INSTALL_DATA) $< $@ - -install-strip: - $(MAKE) -f $(MAKEFILE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install - -install: $(INSTALL_TARGETS:%=$(DESTDIR)%) -ifeq ($(BUILD_SHARED),1) - ln -sf libtinycbor.so.$(VERSION) $(DESTDIR)$(libdir)/libtinycbor.so - ln -sf libtinycbor.so.$(VERSION) $(DESTDIR)$(libdir)/libtinycbor.so.$(SOVERSION) -endif - -uninstall: - $(RM) $(INSTALL_TARGETS:%=$(DESTDIR)%) - $(RM) $(DESTDIR)$(libdir)/libtinycbor.so - $(RM) $(DESTDIR)$(libdir)/libtinycbor.so.$(SOVERSION) - -mostlyclean: - $(RM) $(TINYCBOR_SOURCES:.c=.o) - $(RM) $(TINYCBOR_SOURCES:.c=.pic.o) - $(RM) $(CBORDUMP_SOURCES:.c=.o) - $(RM) src/tinycbor-export.h - -clean: mostlyclean - $(RM) bin/cbordump - $(RM) bin/json2cbor - $(RM) lib/libtinycbor.a - $(RM) lib/libtinycbor-freestanding.a - $(RM) tinycbor.pc - $(RM) lib/libtinycbor.so* - test -e tests/Makefile && $(MAKE) -C tests clean || : - -distclean: clean - test -e tests/Makefile && $(MAKE) -C tests distclean || : - -docs: - cd $(SRCDIR)src && VERSION=$(VERSION) doxygen $(SRCDIR)/../Doxyfile - -dist: $(PACKAGE).tar.gz $(PACKAGE).zip -distcheck: .git - -$(RM) -r $${TMPDIR-/tmp}/tinycbor-distcheck - GIT_DIR=$(SRCDIR).git git archive --prefix=tinycbor-distcheck/ --format=tar HEAD | tar -xf - -C $${TMPDIR-/tmp} - cd $${TMPDIR-/tmp}/tinycbor-distcheck && $(MAKE) silentcheck - $(RM) -r $${TMPDIR-/tmp}/tinycbor-distcheck - -tag: distcheck - @cd $(SRCDIR). && perl scripts/maketag.pl - -.PHONY: all check silentcheck configure install uninstall -.PHONY: mostlyclean clean distclean -.PHONY: docs dist distcheck release -.SECONDARY: - -cflags := $(CPPFLAGS) -I$(SRCDIR)src -cflags += -std=gnu99 $(CFLAGS) - -ifneq ($(DISABLE_WERROR),1) -cflags += \ - $(shell $(CC) -S -Werror -Wdiscarded-qualifiers -o - -xc /dev/null >/dev/null 2>&1 && echo -Werror=discarded-qualifiers) \ - -Werror=incompatible-pointer-types \ - -Werror=implicit-function-declaration \ - -Werror=int-conversion -endif - -%.o: %.c $(TINYCBOR_HEADERS) - @test -d $(@D) || $(MKDIR) $(@D) - $(CC) $(cflags) $($(basename $(notdir $@))_CCFLAGS) -c -o $@ $< -%.pic.o: %.c - @test -d $(@D) || $(MKDIR) $(@D) - $(CC) $(cflags) -fPIC $($(basename $(notdir $@))_CCFLAGS) -c -o $@ $< - --include src/*.d diff --git a/examples/examples.pro b/examples/examples.pro deleted file mode 100644 index 22071ac3..00000000 --- a/examples/examples.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = simplereader.pro diff --git a/examples/simplereader.pro b/examples/simplereader.pro deleted file mode 100644 index 07fdc6ac..00000000 --- a/examples/simplereader.pro +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG -= qt -SOURCES = simplereader.c -include(../src/src.pri) diff --git a/src/tinycbor.pro b/src/tinycbor.pro deleted file mode 100644 index 2ba508a6..00000000 --- a/src/tinycbor.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = lib -CONFIG += static warn_on -CONFIG -= qt -DESTDIR = ../lib - -!msvc:QMAKE_CFLAGS += \ - -Werror=incompatible-pointer-types \ - -Werror=implicit-function-declaration \ - -Werror=int-conversion -include(src.pri) diff --git a/tests/c90/c90.pro b/tests/c90/c90.pro deleted file mode 100644 index 59166b4e..00000000 --- a/tests/c90/c90.pro +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG += testcase parallel_test console -CONFIG -= qt app_bundle -gcc: QMAKE_CFLAGS += -std=c90 -pedantic-errors -Wall -Wextra -Werror -darwin: QMAKE_CFLAGS += -Wno-long-long - -SOURCES += tst_c90.c -INCLUDEPATH += ../../src diff --git a/tests/cpp/cpp.pro b/tests/cpp/cpp.pro deleted file mode 100644 index 5e9e6089..00000000 --- a/tests/cpp/cpp.pro +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG += testcase parallel_test c++11 -QT = core testlib - -SOURCES = tst_cpp.cpp -INCLUDEPATH += ../../src diff --git a/tests/encoder/encoder.pro b/tests/encoder/encoder.pro deleted file mode 100644 index 180f0d78..00000000 --- a/tests/encoder/encoder.pro +++ /dev/null @@ -1,11 +0,0 @@ -SOURCES += tst_encoder.cpp - -CONFIG += testcase parallel_test c++11 -QT = core testlib - -DEFINES += QT_NO_FOREACH QT_NO_AS_CONST - -INCLUDEPATH += ../../src -msvc: POST_TARGETDEPS = ../../lib/tinycbor.lib -else: POST_TARGETDEPS += ../../lib/libtinycbor.a -LIBS += $$POST_TARGETDEPS diff --git a/tests/parser/parser.pro b/tests/parser/parser.pro deleted file mode 100644 index a61291a9..00000000 --- a/tests/parser/parser.pro +++ /dev/null @@ -1,10 +0,0 @@ -SOURCES += tst_parser.cpp ../../src/cborparser.c - -CONFIG += testcase parallel_test c++11 -QT = core testlib -DEFINES += CBOR_PARSER_MAX_RECURSIONS=16 - -INCLUDEPATH += ../../src -msvc: POST_TARGETDEPS = ../../lib/tinycbor.lib -else: POST_TARGETDEPS += ../../lib/libtinycbor.a -LIBS += $$POST_TARGETDEPS diff --git a/tests/tests.pro b/tests/tests.pro deleted file mode 100644 index 627ffbc1..00000000 --- a/tests/tests.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = parser encoder cpp tojson -msvc: SUBDIRS -= tojson diff --git a/tests/tojson/tojson.pro b/tests/tojson/tojson.pro deleted file mode 100644 index b4226520..00000000 --- a/tests/tojson/tojson.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += testcase parallel_test c++11 -QT = core testlib - -SOURCES += tst_tojson.cpp -INCLUDEPATH += ../../src -msvc: POST_TARGETDEPS = ../../lib/tinycbor.lib -else: POST_TARGETDEPS += ../../lib/libtinycbor.a -LIBS += $$POST_TARGETDEPS diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 index fed6108e..00000000 --- a/tools/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CFLAGS = -O2 -g -CPPFLAGS = -I../src -VPATH = cbordump:../src - -all: ../bin ../bin/cbordump -../bin: - @-mkdir ../bin - -../bin/cbordump: cbordump.o cborparser.o cborparser_dup_string.o cbortojson.o cborerrorstrings.o cborpretty.o - $(CC) -o $@ $^ - $(RM) $^ - diff --git a/tools/cbordump/cbordump.pro b/tools/cbordump/cbordump.pro deleted file mode 100644 index 71ae6f76..00000000 --- a/tools/cbordump/cbordump.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = app -CONFIG += console -CONFIG -= app_bundle -CONFIG -= qt -DESTDIR = ../../bin - -CBORDIR = $$PWD/../../src -INCLUDEPATH += $$CBORDIR -SOURCES += cbordump.c -LIBS += ../../lib/libtinycbor.a diff --git a/tools/json2cbor/json2cbor.pro b/tools/json2cbor/json2cbor.pro deleted file mode 100644 index fd6bcd09..00000000 --- a/tools/json2cbor/json2cbor.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = app -CONFIG += console -CONFIG -= app_bundle -CONFIG -= qt -DESTDIR = ../../bin - -CBORDIR = $$PWD/../../src -INCLUDEPATH += $$CBORDIR -SOURCES += json2cbor.c -LIBS += ../../lib/libtinycbor.a - -CJSONDIR = . -!exists($$CJSONDIR/cJSON.h): CJSONDIR = $$CBORDIR/cjson -exists($$CJSONDIR/cJSON.h) { - INCLUDEPATH += $$CJSONDIR - SOURCES += $$CJSONDIR/cJSON.c -} else { - message("cJSON not found, not building json2cbor.") - TEMPLATE = aux -}