@@ -8,7 +8,7 @@ pkgconfigdir = $(libdir)/pkgconfig
8
8
9
9
CFLAGS = -Wall -Wextra
10
10
LDFLAGS_GCSECTIONS = -Wl,--gc-sections
11
- LDFLAGS = $(if $(gc_sections-pass ) ,$(LDFLAGS_GCSECTIONS ) )
11
+ LDFLAGS + = $(if $(gc_sections-pass ) ,$(LDFLAGS_GCSECTIONS ) )
12
12
13
13
GIT_ARCHIVE = git archive --prefix="$(PACKAGE ) /" -9
14
14
INSTALL = install
@@ -28,13 +28,6 @@ TINYCBOR_FREESTANDING_SOURCES = \
28
28
src/cborparser.c \
29
29
src/cborpretty.c \
30
30
#
31
- TINYCBOR_SOURCES = \
32
- $(TINYCBOR_FREESTANDING_SOURCES ) \
33
- src/cborparser_dup_string.c \
34
- src/cborpretty_stdio.c \
35
- src/cbortojson.c \
36
- src/cborvalidation.c \
37
- #
38
31
CBORDUMP_SOURCES = tools/cbordump/cbordump.c
39
32
40
33
BUILD_SHARED = $(shell file -L /bin/sh 2>/dev/null | grep -q ELF && echo 1)
87
80
88
81
-include .config
89
82
83
+ ifeq ($(freestanding-pass ) ,1)
84
+ TINYCBOR_SOURCES = $(TINYCBOR_FREESTANDING_SOURCES )
85
+ else
86
+ TINYCBOR_SOURCES = \
87
+ $(TINYCBOR_FREESTANDING_SOURCES ) \
88
+ src/cborparser_dup_string.c \
89
+ src/cborpretty_stdio.c \
90
+ src/cbortojson.c \
91
+ src/cborvalidation.c \
92
+ #
90
93
# if open_memstream is unavailable on the system, try to implement our own
91
94
# version using funopen or fopencookie
92
95
ifeq ($(open_memstream-pass ) ,)
@@ -97,6 +100,7 @@ ifeq ($(open_memstream-pass),)
97
100
TINYCBOR_SOURCES += src/open_memstream.c
98
101
endif
99
102
endif
103
+ endif
100
104
101
105
# json2cbor depends on an external library (cjson)
102
106
ifneq ($(cjson-pass )$(system-cjson-pass ) ,)
@@ -114,7 +118,8 @@ endif
114
118
all : .config \
115
119
$(if $(subst 0,,$(BUILD_STATIC ) ) ,lib/libtinycbor.a) \
116
120
$(if $(subst 0,,$(BUILD_SHARED ) ) ,lib/libtinycbor.so) \
117
- bin/cbordump tinycbor.pc
121
+ $(if $(freestanding-pass ) ,,bin/cbordump) \
122
+ tinycbor.pc
118
123
all : $(if $(JSON2CBOR_SOURCES ) ,bin/json2cbor)
119
124
check : tests/Makefile | $(BINLIBRARY )
120
125
$(MAKE ) -C tests check
0 commit comments