crossfire/agent-deployment/Makefile

62 lines
1.9 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/>.
.PHONY: all clean
APP_NAME=crossfire-agent
RKT_NAME=$(APP_NAME).rkt
MONOCYPHER_VERSION=3.1.1
####################################################################################################
LIBS=-ldl -lm
# for musl
#LIBS=-lffi -lucontext
VENDOR_DIR=vendor
MONOCYPHER_DIR=$(VENDOR_DIR)/monocypher-$(MONOCYPHER_VERSION)
MONOCYPHER_URL=https://monocypher.org/download/monocypher-$(MONOCYPHER_VERSION).tar.gz
all: $(APP_NAME)
# main build
$(APP_NAME): main_bc.c app.o $(MONOCYPHER_DIR)/lib/libmonocypher.a
$(CC) -o $@ -pipe -fPIC -O3 -DAPP_NAME='"$(APP_NAME)"' -I$(MONOCYPHER_DIR)/src -static $^ \
-L$(MONOCYPHER_DIR)/lib \
-lracket3m -lrktio -lmonocypher $(LIBS)
$(MONOCYPHER_DIR)/lib/libmonocypher.a: $(MONOCYPHER_DIR)/.extracted
cd $(MONOCYPHER_DIR) && $(MAKE) USE_ED22519=true static-library
$(MONOCYPHER_DIR)/.extracted: $(MONOCYPHER_DIR).tar.gz
tar xf $< -C $(VENDOR_DIR) && touch $@
$(MONOCYPHER_DIR).tar.gz:
wget -O $@ $(MONOCYPHER_URL) || curl -o $@ $(MONOCYPHER_URL)
# this is faster than --c-mods by a lot
# it's less portable but like, we're containerized already so it'll work
app.o: app.zo
$(LD) -r -b binary $< -o $@
app.zo: $(RKT_NAME)
raco ctool --mods $@ $<
clean:
$(RM) $(APP_NAME) *.zo *.o