2016-08-29 00:20:40 +03:00
|
|
|
TARGET := source
|
|
|
|
SRCDIR := source
|
2016-11-09 23:39:48 +03:00
|
|
|
TSTDIR := test
|
2016-08-29 00:20:40 +03:00
|
|
|
|
|
|
|
CC ?= gcc
|
|
|
|
|
|
|
|
LIBNAME := modest
|
|
|
|
LIBPOSTFIX := .so
|
|
|
|
LIBSTATIC_POSTFIX := _static
|
2017-02-22 11:49:54 +03:00
|
|
|
IMP_FLAG :=
|
2016-08-29 00:20:40 +03:00
|
|
|
LIB_TMP := lib
|
|
|
|
INCLUDE_TMP := include
|
|
|
|
BIN_TMP := bin
|
|
|
|
|
|
|
|
MODEST_OPTIMIZATION_LEVEL ?= -O2
|
|
|
|
|
|
|
|
CFLAGS ?= -Wall -Werror
|
2017-02-21 23:26:36 +03:00
|
|
|
CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -Wno-unused-variable --std=c99 -I$(SRCDIR)
|
|
|
|
|
|
|
|
ifneq ($(OS),Windows_NT)
|
|
|
|
CFLAGS += -fPIC
|
|
|
|
endif
|
2016-08-29 00:20:40 +03:00
|
|
|
|
2016-10-23 16:09:32 +03:00
|
|
|
ifdef MODEST_BUILD_DEBUG
|
|
|
|
CFLAGS += -g
|
|
|
|
endif
|
|
|
|
|
2016-08-29 00:20:40 +03:00
|
|
|
MODEST_BUILD_WITHOUT_THREADS ?= NO
|
|
|
|
ifeq ($(MODEST_BUILD_WITHOUT_THREADS),YES)
|
|
|
|
$(info Build without POSIX Threads)
|
2016-12-14 22:09:21 +03:00
|
|
|
CFLAGS += -DMODEST_BUILD_WITHOUT_THREADS -DMyHTML_BUILD_WITHOUT_THREADS
|
2016-08-29 00:20:40 +03:00
|
|
|
else
|
|
|
|
$(info Build with POSIX Threads)
|
2017-03-01 16:36:50 +03:00
|
|
|
CFLAGS += -pthread
|
2016-08-29 00:20:40 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
2017-02-22 11:49:54 +03:00
|
|
|
LIBPOSTFIX := .dll
|
|
|
|
IMP_FLAG := -Wl,--out-implib,$(LIB_TMP)/lib$(LIBNAME).dll.a
|
2016-08-29 00:20:40 +03:00
|
|
|
else
|
|
|
|
UNAM := $(shell uname -s)
|
|
|
|
ifeq ($(UNAM),Darwin)
|
|
|
|
LIBPOSTFIX := .dylib
|
|
|
|
else
|
|
|
|
CFLAGS += -D_POSIX_C_SOURCE=199309L
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
SRCS :=
|
|
|
|
HDRS :=
|
2016-11-09 23:39:48 +03:00
|
|
|
EXTDIRS := examples test
|
2016-08-29 00:20:40 +03:00
|
|
|
|
2016-08-29 00:37:43 +03:00
|
|
|
all: create shared static
|
2016-08-29 00:20:40 +03:00
|
|
|
for f in $(EXTDIRS); do $(MAKE) -C $$f all; done
|
|
|
|
|
2017-03-03 09:20:23 +03:00
|
|
|
include $(TARGET)/mycore/Makefile.mk
|
|
|
|
include $(TARGET)/myencoding/Makefile.mk
|
2016-08-29 00:20:40 +03:00
|
|
|
include $(TARGET)/myhtml/Makefile.mk
|
|
|
|
include $(TARGET)/mycss/Makefile.mk
|
2016-09-07 15:29:32 +03:00
|
|
|
include $(TARGET)/myfont/Makefile.mk
|
2017-03-01 21:09:36 +03:00
|
|
|
include $(TARGET)/myurl/Makefile.mk
|
2016-08-29 00:20:40 +03:00
|
|
|
include $(TARGET)/modest/Makefile.mk
|
|
|
|
|
|
|
|
OBJS := $(patsubst %.c,%.o,$(SRCS))
|
|
|
|
|
2016-08-29 00:52:32 +03:00
|
|
|
shared: $(OBJS)
|
2017-03-01 21:09:36 +03:00
|
|
|
$(CC) -shared $(IMP_FLAG) $(LDFLAGS) $(OBJS) -o $(LIB_TMP)/lib$(LIBNAME)$(LIBPOSTFIX)
|
2016-08-29 00:20:40 +03:00
|
|
|
|
|
|
|
static: shared
|
2017-03-01 21:09:36 +03:00
|
|
|
$(AR) crus $(LIB_TMP)/lib$(LIBNAME)$(LIBSTATIC_POSTFIX).a $(OBJS)
|
2016-08-29 00:20:40 +03:00
|
|
|
|
2016-08-29 00:37:43 +03:00
|
|
|
create:
|
|
|
|
mkdir -p lib bin
|
|
|
|
|
2016-08-29 00:20:40 +03:00
|
|
|
clean:
|
|
|
|
for f in $(EXTDIRS); do $(MAKE) -C $$f clean; done
|
|
|
|
rm -f $(OBJS)
|
|
|
|
rm -f $(LIB_TMP)/*
|
|
|
|
rm -f $(BIN_TMP)/*
|
|
|
|
|
|
|
|
clean_include:
|
|
|
|
rm -rf $(INCLUDE_TMP)
|
|
|
|
|
2017-03-03 09:20:23 +03:00
|
|
|
clone: create clean_include myhtml_clone mycss_clone modest_clone myfont_clone myurl_clone mycore_clone myencoding_clone
|
2016-08-29 00:20:40 +03:00
|
|
|
find include -name "*.h" -exec sed -i '.bak' -E 's/^[ \t]*#[ \t]*include[ \t]*"([^"]+)"/#include <\1>/g' {} \;
|
|
|
|
find include -name "*.h.bak" -exec rm -f {} \;
|
|
|
|
|
2016-11-09 23:39:48 +03:00
|
|
|
test:
|
|
|
|
test/mycss/declaration test/mycss/data/declaration
|
2016-11-21 02:12:38 +03:00
|
|
|
test/myhtml/utils/avl_tree
|
2017-02-14 14:49:05 +03:00
|
|
|
test/myhtml/encoding_detect_meta test/myhtml/data/encoding/detect_meta.html
|
2017-03-01 16:07:21 +03:00
|
|
|
test/myurl/url test/myurl/data
|
2016-11-09 23:39:48 +03:00
|
|
|
|
2017-02-21 23:26:36 +03:00
|
|
|
.PHONY: all clean clone test
|