| 1 |
HC_VERS = 1.22 |
| 2 |
CHANGEME1 = 1 # put PACKAGER = EBUILD|RPM etc here |
| 3 |
CHANGEME2 = 2 |
| 4 |
CHANGEME3 = 3 |
| 5 |
INSTALL_PATH = /usr/bin |
| 6 |
MAN_INSTALL_PATH = /usr/share/man/man1 |
| 7 |
DOC_INSTALL_PATH = /usr/share/doc/hashcash-$(HC_VERS) |
| 8 |
MAKEDEPEND = makedepend |
| 9 |
MSLIB = mslib |
| 10 |
# here you can choose the regexp style your system has |
| 11 |
# default is POSIX |
| 12 |
# REGEXP = -DREGEXP_POSIX |
| 13 |
# if no POSIX regexp support, try BSD |
| 14 |
# REGEXP = -DREGEXP_BSD |
| 15 |
# if no POSIX or BSD, disable, still have builtin basic wildcard support |
| 16 |
# REGEXP = |
| 17 |
REGEXP=-DREGEXP_POSIX |
| 18 |
COPT_DEBUG = -g -DDEBUG |
| 19 |
COPT_GENERIC = -O3 |
| 20 |
COPT_GNU = -O3 -funroll-loops |
| 21 |
COPT_X86 = -O3 -funroll-loops -march=pentium-mmx -mmmx \ |
| 22 |
-D_REENTRANT -D_THREAD_SAFE -fPIC |
| 23 |
COPT_MINGW = -O3 -funroll-loops -march=pentium-mmx -mmmx \ |
| 24 |
-D_REENTRANT -D_THREAD_SAFE |
| 25 |
COPT_G3_OSX = -O3 -funroll-loops -fno-inline -mcpu=750 -faltivec |
| 26 |
COPT_PPC_LINUX = -O3 -funroll-loops -fno-inline -mcpu=604e -maltivec \ |
| 27 |
-mabi=altivec |
| 28 |
LIB=.a |
| 29 |
# request static link of -lcrypto only |
| 30 |
LIBCRYPTO=/usr/lib/libcrypto.a |
| 31 |
EXES = hashcash$(EXE) sha1$(EXE) sha1test$(EXE) |
| 32 |
INSTALL = install |
| 33 |
POD2MAN = pod2man |
| 34 |
POD2HTML = pod2html |
| 35 |
POD2TEXT = pod2text |
| 36 |
DELETE = rm -f |
| 37 |
ETAGS = etags |
| 38 |
FASTLIBS = libfastmint.o fastmint_mmx_standard_1.o fastmint_mmx_compact_1.o \ |
| 39 |
fastmint_ansi_compact_1.o fastmint_ansi_standard_1.o \ |
| 40 |
fastmint_ansi_compact_2.o fastmint_ansi_standard_2.o \ |
| 41 |
fastmint_altivec_standard_1.o fastmint_altivec_standard_2.o \ |
| 42 |
fastmint_altivec_compact_2.o fastmint_ansi_ultracompact_1.o \ |
| 43 |
fastmint_library.o |
| 44 |
OBJS = libsha1.o libhc.o sdb.o lock.o utct.o random.o sstring.o \ |
| 45 |
$(FASTLIBS) |
| 46 |
LIBOBJS = libhc.o libsha1.o utct.o sdb.o lock.o sstring.o random.o $(FASTLIBS) |
| 47 |
EXEOBJS = hashcash.o |
| 48 |
|
| 49 |
DIST = ../dist.csh |
| 50 |
|
| 51 |
default: help generic |
| 52 |
|
| 53 |
help: |
| 54 |
@echo "make <platform> where platform is:" |
| 55 |
@echo " x86, mingw, mingw-dll, g3-osx, ppc-linux, gnu, generic, debug" |
| 56 |
@echo "or to link with openSSL for SHA1 rather than builtin:" |
| 57 |
@echo " x86-openssl, g3-osx-openssl, ppc-linux-openssl, " |
| 58 |
@echo " gnu-openssl, generic-openssl, debug-openssl" |
| 59 |
@echo "other make targets are docs, install, clean, distclean, docclean" |
| 60 |
@echo "" |
| 61 |
@echo "(doing make generic by default)" |
| 62 |
@echo "" |
| 63 |
|
| 64 |
generic: |
| 65 |
$(MAKE) "CFLAGS=$(CFLAGS) $(REGEXP) $(COPT_GENERIC) $(COPT)" build |
| 66 |
|
| 67 |
debug: |
| 68 |
$(MAKE) "CFLAGS=$(CFLAGS) $(REGEXP) $(COPT_DEBUG) $(COPT)" build |
| 69 |
|
| 70 |
gnu: |
| 71 |
$(MAKE) "CFLAGS=$(CFLAGS) $(REGEXP) $(COPT_GNU) $(COPT)" "CC=gcc" build |
| 72 |
|
| 73 |
x86: |
| 74 |
$(MAKE) "CFLAGS=$(CFLAGS) $(REGEXP) $(COPT_X86) $(COPT)" build |
| 75 |
|
| 76 |
g3-osx: |
| 77 |
$(MAKE) "CFLAGS=$(CFLAGS) $(REGEXP) $(COPT_G3_OSX) $(COPT)" build |
| 78 |
|
| 79 |
ppc-linux: |
| 80 |
$(MAKE) "CFLAGS=$(CFLAGS) $(REGEXP) $(COPT_PPC_LINUX) $(COPT)" build |
| 81 |
|
| 82 |
# mingw windows targets (cross compiler, or native) |
| 83 |
|
| 84 |
mingw: |
| 85 |
$(MAKE) "LIB=.lib" "CC=gcc" "EXE=.exe" "CFLAGS=$(COPT_MINGW) -DMONOLITHIC $(COPT)" build |
| 86 |
|
| 87 |
mingw-dll: |
| 88 |
$(MAKE) "CC=gcc" "EXE=.exe" "CFLAGS=$(COPT_MINGW) $(COPT)" build-dll |
| 89 |
|
| 90 |
|
| 91 |
# openSSL versions of targets |
| 92 |
|
| 93 |
x86-openssl: |
| 94 |
$(MAKE) x86 "CFLAGS=$(CFLAGS) -DOPENSSL" "LDFLAGS=$(LDFLAGS) $(LIBCRYPTO)" |
| 95 |
|
| 96 |
g3-osx-openssl: |
| 97 |
$(MAKE) g3-osx "CFLAGS=$(CFLAGS) -DOPENSSL" "LDFLAGS=$(LDFLAGS) $(LIBCRYPTO)" |
| 98 |
|
| 99 |
ppc-linux-openssl: |
| 100 |
$(MAKE) ppc-linux "CFLAGS=$(CFLAGS) -DOPENSSL" "LDFLAGS=$(LDFLAGS) $(LIBCRYPTO)" |
| 101 |
|
| 102 |
gnu-openssl: |
| 103 |
$(MAKE) gnu "CFLAGS=$(CFLAGS) -DOPENSSL" "LDFLAGS=$(LDFLAGS) $(LIBCRYPTO)" |
| 104 |
|
| 105 |
generic-openssl: |
| 106 |
$(MAKE) generic "CFLAGS=$(CFLAGS) -DOPENSSL" "LDFLAGS=$(LDFLAGS) $(LIBCRYPTO)" |
| 107 |
|
| 108 |
debug-openssl: |
| 109 |
$(MAKE) debug "CFLAGS=$(CFLAGS) -DOPENSSL" "LDFLAGS=$(LDFLAGS) $(LIBCRYPTO)" |
| 110 |
|
| 111 |
|
| 112 |
build: hashcash$(EXE) sha1$(EXE) |
| 113 |
|
| 114 |
build-dll: hashcash-dll$(EXE) sha1$(EXE) |
| 115 |
|
| 116 |
hashcash$(EXE): hashcash.o libhashcash$(LIB) |
| 117 |
$(CC) hashcash.o libhashcash$(LIB) -o $@ $(LDFLAGS) |
| 118 |
|
| 119 |
sha1$(EXE): sha1.o libsha1.o |
| 120 |
$(CC) sha1.o libsha1.o -o $@ $(LDFLAGS) |
| 121 |
|
| 122 |
example$(EXE): example.o getopt.o libhashcash$(LIB) |
| 123 |
$(CC) example.o getopt.o libhashcash$(LIB) $(LIBCRYPTO) -o $@ $(LDFLAGS) |
| 124 |
|
| 125 |
hashcash-dll$(EXE): $(EXEOBJS) hashcash.dll |
| 126 |
$(CC) $(EXEOBJS) hashcash.dll -o $@ $(LDFLAGS) |
| 127 |
|
| 128 |
sha1test$(EXE): sha1test.o libsha1.o |
| 129 |
$(CC) sha1test.o libsha1.o -o $@ $(LDFLAGS) |
| 130 |
|
| 131 |
all: $(EXES) |
| 132 |
|
| 133 |
libhashcash$(LIB): $(LIBOBJS) |
| 134 |
$(DELETE) $@ |
| 135 |
$(AR) rcs $@ $(LIBOBJS) |
| 136 |
|
| 137 |
hashcash.dll: $(LIBOBJS) |
| 138 |
$(CC) -shared -o hashcash.dll $(LIBOBJS) \ |
| 139 |
-Wl,--output-def,hashcash.def,--out-implib,libhashcash.a |
| 140 |
$(MSLIB) /machine:x86 /def:hashcash.def |
| 141 |
|
| 142 |
docs: hashcash.1 hashcash.html hashcash.txt sha1-hashcash.1 \ |
| 143 |
sha1-hashcash.html sha1-hashcash.txt |
| 144 |
|
| 145 |
hashcash.1: hashcash.pod |
| 146 |
$(POD2MAN) -s 1 -c hashcash -r $(HC_VERS) $? > $@ |
| 147 |
|
| 148 |
hashcash.html: hashcash.pod |
| 149 |
$(POD2HTML) --title hashcash $? > $@ |
| 150 |
$(DELETE) pod2htm* |
| 151 |
|
| 152 |
hashcash.txt: hashcash.pod |
| 153 |
$(POD2TEXT) $? > $@ |
| 154 |
|
| 155 |
sha1-hashcash.1: sha1-hashcash.pod |
| 156 |
$(POD2MAN) -s 1 -c sha1 -r $(HC_VERS) $? > $@ |
| 157 |
|
| 158 |
sha1-hashcash.html: sha1-hashcash.pod |
| 159 |
$(POD2HTML) --title sha1 $? > $@ |
| 160 |
$(DELETE) pod2htm* |
| 161 |
|
| 162 |
sha1-hashcash.txt: sha1-hashcash.pod |
| 163 |
$(POD2TEXT) $? > $@ |
| 164 |
|
| 165 |
install: hashcash sha1 hashcash.1 sha1-hashcash.1 |
| 166 |
$(INSTALL) -d $(INSTALL_PATH) |
| 167 |
$(INSTALL) hashcash sha1 $(INSTALL_PATH) |
| 168 |
$(INSTALL) -d $(MAN_INSTALL_PATH) |
| 169 |
$(INSTALL) -m 644 hashcash.1 sha1-hashcash.1 $(MAN_INSTALL_PATH) |
| 170 |
$(INSTALL) -d $(DOC_INSTALL_PATH) |
| 171 |
$(INSTALL) -m 644 README LICENSE CHANGELOG $(DOC_INSTALL_PATH) |
| 172 |
|
| 173 |
depend: |
| 174 |
$(MAKEDEPEND) -- -Y *.c *.h |
| 175 |
|
| 176 |
docclean: |
| 177 |
$(DELETE) hashcash.txt hashcash.1 hashcash.html pod2htm* |
| 178 |
$(DELETE) sha1-hashcash.txt sha1-hashcash.1 sha1-hashcash.html |
| 179 |
|
| 180 |
clean: |
| 181 |
$(DELETE) *.o *~ |
| 182 |
|
| 183 |
distclean: |
| 184 |
$(DELETE) *.o *~ $(EXES) hashcash-dll.* *.db *.bak TAGS core* |
| 185 |
$(DELETE) *.bak test/* *.dll *.lib *.exe *.a *.sdb |
| 186 |
|
| 187 |
tags: |
| 188 |
$(ETAGS) *.c *.h |
| 189 |
|
| 190 |
dist: |
| 191 |
$(DIST) |
| 192 |
|
| 193 |
# DO NOT DELETE |
| 194 |
|
| 195 |
example.o: sstring.h sdb.h hashcash.h getopt.h |
| 196 |
fastmint_altivec_compact_2.o: libfastmint.h hashcash.h |
| 197 |
fastmint_altivec_standard_1.o: libfastmint.h hashcash.h |
| 198 |
fastmint_altivec_standard_2.o: libfastmint.h hashcash.h |
| 199 |
fastmint_ansi_compact_1.o: libfastmint.h hashcash.h |
| 200 |
fastmint_ansi_compact_2.o: libfastmint.h hashcash.h |
| 201 |
fastmint_ansi_standard_1.o: libfastmint.h hashcash.h |
| 202 |
fastmint_ansi_standard_2.o: libfastmint.h hashcash.h |
| 203 |
fastmint_ansi_ultracompact_1.o: libfastmint.h hashcash.h |
| 204 |
fastmint_library.o: sha1.h types.h libfastmint.h hashcash.h |
| 205 |
fastmint_mmx_compact_1.o: libfastmint.h hashcash.h |
| 206 |
fastmint_mmx_standard_1.o: libfastmint.h hashcash.h |
| 207 |
getopt.o: getopt.h |
| 208 |
hashcash.o: sdb.h utct.h random.h hashcash.h libfastmint.h sstring.h |
| 209 |
hashcash.o: sha1.h types.h |
| 210 |
libfastmint.o: random.h sha1.h types.h libfastmint.h hashcash.h |
| 211 |
libhc.o: hashcash.h utct.h libfastmint.h sha1.h types.h random.h sstring.h |
| 212 |
libsha1.o: sha1.h types.h |
| 213 |
lock.o: lock.h |
| 214 |
random.o: random.h sha1.h types.h |
| 215 |
sdb.o: types.h lock.h sdb.h utct.h |
| 216 |
sha1.o: sha1.h types.h |
| 217 |
sha1test.o: sha1.h types.h |
| 218 |
sstring.o: sstring.h |
| 219 |
utct.o: sstring.h utct.h |
| 220 |
libfastmint.o: hashcash.h |
| 221 |
sha1.o: types.h |