# This file is in the public domain. # Generate a list of algorithm .o files. See list-algs.sh. ALGS_O != ./list-algs.sh -o < alg-lists # Turn on debugging. CC_ADD = -g # Figure out whether we want NEW_CMSG_INTERFACE (see scm-rights.h). # If building on non-NetBSD, you may need to tweak the .if test. OS != uname -s OSREV != uname -r .if "${OS}" == "NetBSD" && ${OSREV:C/\..*//} > 1 CC_ADD += -DNEW_CMSG_INTERFACE .endif # What we want to build. BUILDBINS = moussh # Manpages to be installed (source files). INSTALLMAN = moussh.1 # .o files that make up moussh. OBJ_moussh = $(ALGS_O) agent-client.o agent-int.o agent-server.o\ agent-util.o alg-util.o algs-list.o algs.o b64.o bpp.o channels.o\ client.o config.o connshare-auto.o connshare-c.o connshare-s.o errf.o\ escaped.o hkdb.o hostkey.o interact.o keepalive.o keyfiles.o keygen.o\ keyutils.o main.o oq.o panic.o pkt-util.o pollloop.o pp.o priv-crypto.o\ rnd.o server.o signature.o small-primes.o stdio-util.o str.o\ transport.o userauth-conn-c.o userauth-conn-s.o util.o verbose.o\ writev.o x.o # Work out the dequal .o file name. Fetch the architecture name, and, if # we have an arch-specific .s file for that arch, use it; otherwise, use # the C version. ARCH != uname -m .if exists(dequal-$(ARCH).s) || exists(dequal-$(ARCH).S) OBJ_moussh += dequal-$(ARCH).o .else OBJ_moussh += dequal-C.o .endif # Libraries to link moussh with. LIBS_moussh = -lXau -larc4 -lblowfish -lcrypt -ldes -ldsa -lgmp -lidea\ -lmd5 -lrijndael -lsha -lz # On some arches, we wrap malloc calls. This is indicated by the # presence of a malwrap-$ARCH.c file for that arch. If it's there, # include the malloc wrapper files, and tack on the linker options # to wrap the relevant calls. .if exists(malwrap-$(ARCH).c) OBJ_moussh += malwrap-$(ARCH).o malwrap.o LIBS_moussh += -Wl,--wrap,malloc,--wrap,free,--wrap,realloc,--wrap,calloc -static .endif # What to build if no target is named. .MAIN: $(BUILDBINS) moussh.cat1 # Stuff not built according to the default rules. # algs-list.c is built from alg-lists by list-algs.sh; algs-list.h is # built from algs-list.c by picking out the relevant lines. wraphfile # is a localism; if you don't have it, don't worry about it. That's why # it's marked with a -, so that if the command fails make doesn't mind. # Don't forget to include them in PREDEPEND and CLEANFILES. PREDEPEND += algs-list.c algs-list.h CLEANFILES += algs-list.c algs-list.h algs-list.c: list-algs.sh alg-lists ./list-algs.sh -c < alg-lists > algs-list.c algs-list.h: algs-list.c egrep '(^#include|^extern|public domain)' < algs-list.c > algs-list.h -wraphfile algs-list.h # Verbosity stuff. verbose-table.inc drives this; it is #included by # both verbose.c and gen-verbose-bits.c; the former is the verbosity # code itself, while the latter just generates the #defines for # verbose-bits.h. (We depend on "make depend" to get the rest of the # dependencies right here.) As above, wraphfile is a localism. PREDEPEND += verbose-bits.h CLEANFILES += verbose-bits.h gen-verbose-bits gen-verbose-bits.o verbose-bits.h: gen-verbose-bits ./gen-verbose-bits > verbose-bits.h -wraphfile verbose-bits.h gen-verbose-bits: gen-verbose-bits.o $(CC) -o gen-verbose-bits gen-verbose-bits.o # moussh uses labeled control structure. On my systems, I've put this # into gcc (it's fairly straightforward). While a full implementation # of labeled control structure really does need to be in the compiler, # moussh doesn't use the full power of it, and it's feasible to convert # the limited subset used to standard C (or at least gcc) with purely # textual hacks, without needing a full codewalker. That's what lcs-cvt # is for. The test here is basically testing "is this one of Mouse's # systems"; this is not the best test possible, but it's probably good # enough for the purpose at hand. (Basically, if it's 1.4T and # /local/bin/mcsh exists, I assume it's mine.) If it's not my system, # a .c.o rule is added which runs lcs-cvt in between the preprocessor # and the compielr proper. UNAME_R != uname -r .undef MOUSEISMS_TEST .if "$(UNAME_R)" == "1.4T" .if exists(/local/bin/mcsh) MOUSEISMS_TEST = yes .endif .endif CLEANFILES += lcs-cvt _.i .ifndef MOUSEISMS_TEST .c.o: lcs-cvt $< $(CC) $(CPPFLAGS) -E $< -o _.i && ./lcs-cvt _.i && $(CC) $(CFLAGS) -c _.i -o $@ .endif # This is here to suppress the lcs-cvt code in . USE_LCS_CVT= # The rest of the Makefile is a stock file. You may need to use -I. to # get make to pick this up from the current directory. .include