Skip to content

Instantly share code, notes, and snippets.

@kosh04
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosh04/36d754f6f9a99fcdf374 to your computer and use it in GitHub Desktop.
Save kosh04/36d754f6f9a99fcdf374 to your computer and use it in GitHub Desktop.
newLISPの埋め込みPCREを最新バージョンに置き換える
# -*- mode: makefile -*-
#
# force update PCRE embedded in newLISP
# ~> wget http://www.newlisp.org/downloads/development/newlisp-10.6.1.tgz
# ~> tar xvf newlisp-10.6.1.tgz
# ~> cd newlisp-10.6.1
# ~> curl -LOk https://gist.githubusercontent.com/kosh04/36d754f6f9a99fcdf374/raw/Makefile.pcre
# ~> make -f Makefile.pcre enable_utf8=1
# ~> make -f Makefile.pcre test
main_OBJS := \
newlisp.o \
nl-debug.o \
nl-filesys.o \
nl-import.o \
nl-list.o \
nl-liststr.o \
nl-math.o \
nl-matrix.o \
nl-sock.o \
nl-string.o \
nl-symbol.o \
nl-web.o \
nl-xml-json.o
# nl-utf8.o
# pcre.o
# pcre
pcre_name := pcre-8.36
pcre_dir := $(pcre_name)
pcre_archive := $(pcre_name).tar.gz
pcre_archive_url := ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/$(pcre_archive)
pcre_OBJS := \
$(pcre_dir)/pcre_compile.o \
$(pcre_dir)/pcre_exec.o \
$(pcre_dir)/pcre_fullinfo.o \
$(pcre_dir)/pcre_tables.o \
$(pcre_dir)/pcre_newline.o \
$(pcre_dir)/pcre_globals.o \
$(pcre_dir)/pcre_chartables.o \
$(pcre_dir)/pcre_version.o
pcre_utf8_OBJS := \
$(pcre_OBJS) \
$(pcre_dir)/pcre_ord2utf8.o \
$(pcre_dir)/pcre_valid_utf8.o \
$(pcre_dir)/pcre_xclass.o
TARGET := newlisp
OBJS := $(main_OBJS)
OBJS += $(if $(enable_utf8), nl-utf8.o)
OBJS += $(if $(enable_utf8), $(pcre_utf8_OBJS), $(pcre_OBJS))
DEFS := $(if $(enable_utf8), -DSUPPORT_UTF8)
LIBS :=
# OS depends
uname_S := $(shell uname -s || echo 'unknown')
ifeq (MINGW,$(findstring MINGW,$(uname_S)))
OBJS += win32-path.o \
win32-util.o
# win32dll.o
DEFS += -DWIN_32
LIBS += -lws2_32
else ifeq (Darwin,$(uname_S))
DEFS += -DMAC_OSX
LIBS +=
else ifeq (Linux,$(uname_S))
DEFS += -DLINUX
LIBS += -lm -ldl
endif
# compiler setup
CC ?= cc
CFLAGS := -Wall -g -O2
CFLAGS += -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing
CPPFLAGS := $(DEFS)
LDFLAGS :=
LDLIBS := $(LIBS)
WGET := wget
#WGET := curl -O
.PHONY: all
all: newlisp
newlisp: $(OBJS)
$(pcre_dir)/%.o: CFLAGS = -Wall -g -O2
$(pcre_dir)/%.o: CPPFLAGS = -DHAVE_CONFIG_H $(if $(enable_utf8), -DSUPPORT_UTF8)
$(pcre_OBJS): | $(pcre_dir)
$(pcre_OBJS): $(pcre_dir)/config.h
$(pcre_dir)/config.h: | $(pcre_dir)
$(pcre_dir)/config.h:
cd $(pcre_dir) && sh ./configure $(if $(enable_utf8), --enable-utf8, --disable-utf8)
$(pcre_dir)/pcre_chartables.o: $(pcre_dir)/pcre_chartables.c
$(pcre_dir)/pcre_chartables.c: $(pcre_dir)/pcre_chartables.c.dist
cp -p $< $@
$(pcre_dir): $(pcre_archive)
tar xvf $(pcre_archive)
$(pcre_archive):
$(WGET) $(pcre_archive_url)
.PHONY: check test
check test:
$(MAKE) check
.PHONY: clean
clean:
-$(MAKE) clean
-$(MAKE) -C $(pcre_dir) distclean
.PHONY: help usage
help usage:
@echo "make -f Makefile.pcre [enable_utf8=1]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment