baseten / Tools /

include Tools/

PCRE_BUILD_DIR   = $(BUILD_DIR)/Release/BaseTen-pcre
PCRE_VERSION     = 8.02
PCRE_SOURCE_FILE = Contrib/pcre/pcre-$(PCRE_VERSION).tar.bz2
UNIVERSAL_LIBS   = $(foreach my_arch,$(ARCHS),$(PCRE_BUILD_DIR)/$(my_arch)/lib/libpcre.a)

.PHONY: all clean build build-specifics build-arch

all: build

	$(RM) -rf $(PCRE_BUILD_DIR)

build: $(PCRE_BUILD_DIR)/universal/include/pcre.h $(PCRE_BUILD_DIR)/universal/lib/libpcre.a

build-arch: $(PCRE_ROOT)
	-$(MAKE) -j $(AVAILCPU) -C $(PCRE_ROOT) distclean

	cd "$(PCRE_ROOT)" && \
	CC="$(CC_$(ARCH))" \
	./configure --build=$(shell $(PCRE_ROOT)/config.guess) --host=$(TARGET_$(ARCH)) --target=$(TARGET_$(ARCH)) \
		--prefix="$(PCRE_BUILD_DIR)/$(ARCH)" --enable-static --disable-shared --enable-utf8 --enable-unicode-properties

	$(MAKE) -j $(AVAILCPU) -C $(PCRE_ROOT) all
	$(MAKE) -C $(PCRE_ROOT) install

$(PCRE_BUILD_DIR)/universal/lib/libpcre.a: $(UNIVERSAL_LIBS)
	$(MKDIR) -p $(PCRE_BUILD_DIR)/universal/lib
	$(LIPO) $(UNIVERSAL_LIBS) -create -output $(PCRE_BUILD_DIR)/universal/lib/libpcre.a

$(PCRE_BUILD_DIR)/%/lib/libpcre.a: $(PCRE_SOURCE_FILE)
	ARCH=$* $(MAKE) -f Tools/ build-arch

$(PCRE_BUILD_DIR)/universal/include/pcre.h: $(PCRE_ROOT)/pcre.h.generic
	$(MKDIR) -p $(PCRE_BUILD_DIR)/universal/include
	$(CP) $(PCRE_ROOT)/pcre.h.generic $(PCRE_BUILD_DIR)/universal/include/pcre.h

$(PCRE_ROOT)/pcre.h.generic : $(PCRE_ROOT)

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.