124 lines
3.6 KiB
Makefile
124 lines
3.6 KiB
Makefile
# crossfire: distributed brute force infrastructure
|
|
#
|
|
# Copyright (C) 2020 haskal
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
CACHE_DIR=cache
|
|
VENDOR_DIR=$(ARCH_DIR)/vendor
|
|
|
|
MONOCYPHER_DIR=$(VENDOR_DIR)/monocypher-$(MONOCYPHER_VERSION)
|
|
MONOCYPHER_URL=https://monocypher.org/download/monocypher-$(MONOCYPHER_VERSION).tar.gz
|
|
MONOCYPHER_FILE=$(CACHE_DIR)/monocypher.tar.gz
|
|
|
|
RACKET_DIR=$(VENDOR_DIR)/racket-$(RACKET_VERSION)
|
|
RACKET_URL=https://mirror.racket-lang.org/installers/$(RACKET_VERSION)/racket-minimal-$(RACKET_VERSION)-src.tgz
|
|
RACKET_FILE=$(CACHE_DIR)/racket.tar.gz
|
|
|
|
define download-file =
|
|
[ -d $(CACHE_DIR) ] || mkdir -p $(CACHE_DIR)
|
|
wget -O $@ $1 || curl -o $@ $1
|
|
endef
|
|
|
|
define extract-file =
|
|
[ -d $1 ] || mkdir -p $1
|
|
tar xf $< -C $(VENDOR_DIR) && touch $@
|
|
endef
|
|
|
|
VND_CFLAGS=
|
|
VND_LDFLAGS=
|
|
|
|
.PHONY: vnd-deps-clean vnd-deps vnd-deps-dl
|
|
|
|
mrproper: vnd-deps-clean
|
|
vnd-deps-clean:
|
|
$(RM) -r $(VENDOR_DIR) $(CACHE_DIR)
|
|
|
|
|
|
## monocypher
|
|
|
|
VND_MONOCYPHER=$(MONOCYPHER_DIR)/lib/libmonocypher.a
|
|
VND_MONOCYPHER_CFLAGS=-I$(MONOCYPHER_DIR)/src
|
|
VND_MONOCYPHER_LDFLAGS=-L$(MONOCYPHER_DIR)/lib -lmonocypher
|
|
|
|
$(VND_MONOCYPHER): $(MONOCYPHER_DIR)/.extracted
|
|
cd $(MONOCYPHER_DIR) && $(MAKE) USE_ED22519=true static-library
|
|
|
|
$(MONOCYPHER_DIR)/.extracted: $(MONOCYPHER_FILE)
|
|
$(call extract-file,$(MONOCYPHER_DIR))
|
|
|
|
$(MONOCYPHER_FILE):
|
|
$(call download-file,$(MONOCYPHER_URL))
|
|
|
|
vnd-deps-dl: $(MONOCYPHER_FILE)
|
|
VND_CFLAGS+=$(VND_MONOCYPHER_CFLAGS)
|
|
VND_LDFLAGS+=$(VND_MONOCYPHER_LDFLAGS)
|
|
vnd-deps: $(VND_MONOCYPHER)
|
|
|
|
|
|
## racket
|
|
|
|
### racket BC
|
|
|
|
VND_RACKET_BC=$(RACKET_DIR)/lib/libracket3m.a
|
|
VND_RACKET_BC_CFLAGS=-I$(RACKET_DIR)/src/include
|
|
VND_RACKET_BC_LDFLAGS=-L$(RACKET_DIR)/lib -lracket3m -lrktio -lffi
|
|
# musl also needs -lucontext
|
|
|
|
$(VND_RACKET_BC): $(RACKET_DIR)/.extracted
|
|
cd $(RACKET_DIR)/src && ./configure --enable-bconly --prefix=/usr --sysconfdir=/etc \
|
|
--disable-libffi --disable-docs
|
|
cd $(RACKET_DIR)/src && $(MAKE)
|
|
[ -d $(RACKET_DIR)/lib ] || mkdir $(RACKET_DIR)/lib
|
|
cp $(RACKET_DIR)/src/bc/rktio/librktio.a $(RACKET_DIR)/lib
|
|
cp $(RACKET_DIR)/src/bc/libracket3m.a $(RACKET_DIR)/lib
|
|
cp $(RACKET_DIR)/src/bc/foreign/libffi/.libs/libffi.a $(RACKET_DIR)/lib
|
|
|
|
### racket CS
|
|
|
|
VND_RACKET_CS=$(RACKET_DIR)/lib/libracketcs.a
|
|
VND_RACKET_CS_CFLAGS=-I$(RACKET_DIR)/include
|
|
VND_RACKET_CS_LDFLAGS=-L$(RACKET_DIR)/lib -lracketcs
|
|
|
|
$(VND_RACKET_CS): $(RACKET_DIR)/.extracted
|
|
cd $(RACKET_DIR)/src && ./configure --enable-csonly --disable-docs
|
|
cd $(RACKET_DIR)/src && $(MAKE)
|
|
cd $(RACKET_DIR)/src && $(MAKE) install
|
|
cd $(RACKET_DIR) && bin/raco pkg install -i --auto cext-lib
|
|
|
|
### racket common
|
|
|
|
ifdef ENABLE_CS
|
|
vnd-deps: $(VND_RACKET_CS)
|
|
VND_CFLAGS+=$(VND_RACKET_CS_CFLAGS)
|
|
VND_LDFLAGS+=$(VND_RACKET_CS_LDFLAGS)
|
|
RACO=$(RACKET_DIR)/bin/raco
|
|
RACKET_CS_BOOT_FILES_DIR=$(RACKET_DIR)/lib
|
|
else
|
|
vnd-deps: $(VND_RACKET_BC)
|
|
VND_CFLAGS+=$(VND_RACKET_BC_CFLAGS)
|
|
VND_LDFLAGS+=$(VND_RACKET_BC_LDFLAGS)
|
|
RACO=raco
|
|
endif
|
|
|
|
### racket download
|
|
|
|
$(RACKET_DIR)/.extracted: $(RACKET_FILE)
|
|
$(call extract-file,$(RACKET_DIR))
|
|
|
|
$(RACKET_FILE):
|
|
$(call download-file,$(RACKET_URL))
|
|
|
|
vnd-deps-dl: $(RACKET_FILE)
|