diff --git a/BSDmakefile b/BSDmakefile new file mode 100644 index 0000000..71f18a1 --- /dev/null +++ b/BSDmakefile @@ -0,0 +1,55 @@ +# This file is part of mktorrent +# Copyright (C) 2007, 2009 Emil Renner Berthing +# +# mktorrent is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# mktorrent 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +.include Makefile + +CC ?= cc +CFLAGS ?= -O2 -Wall +INSTALL ?= install +PREFIX ?= /usr/local + +.ifdef USE_PTHREADS +DEFINES += -DUSE_PTHREADS +SRCS := $(SRCS:hash.c=hash_pthreads.c) +LIBS += -lpthread +.endif + +.ifdef USE_OPENSSL +DEFINES += -DUSE_OPENSSL +SRCS := $(SRCS:sha1.c=) +LIBS += -lssl +.endif + +.ifdef NO_LONG_OPTIONS +DEFINES += -DNO_LONG_OPTIONS +.endif + +.ifdef NO_HASH_CHECK +DEFINES += -DNO_HASH_CHECK +.endif + +.ifdef MAX_OPENFD +DEFINES += -DMAX_OPENFD="$(MAX_OPENFD)" +.endif + +.ifdef DEBUG +DEFINES += -DDEBUG +.endif + +OBJS = $(SRCS:.c=.o) + +.include rules.mk diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..3cc4d2a --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,55 @@ +# This file is part of mktorrent +# Copyright (C) 2007, 2009 Emil Renner Berthing +# +# mktorrent is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# mktorrent 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +include Makefile + +CC ?= cc +CFLAGS ?= -O2 -Wall +INSTALL ?= install +PREFIX ?= /usr/local + +ifdef USE_PTHREADS +DEFINES += -DUSE_PTHREADS +SRCS := $(SRCS:hash.c=hash_pthreads.c) +LIBS += -lpthread +endif + +ifdef USE_OPENSSL +DEFINES += -DUSE_OPENSSL +SRCS := $(SRCS:sha1.c=) +LIBS += -lssl +endif + +ifdef NO_LONG_OPTIONS +DEFINES += -DNO_LONG_OPTIONS +endif + +ifdef NO_HASH_CHECK +DEFINES += -DNO_HASH_CHECK +endif + +ifdef MAX_OPENFD +DEFINES += -DMAX_OPENFD="$(MAX_OPENFD)" +endif + +ifdef DEBUG +DEFINES += -DDEBUG +endif + +OBJS = $(SRCS:.c=.o) + +include rules.mk diff --git a/Makefile b/Makefile index bf07a30..f52ad7c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # This file is part of mktorrent -# Copyright (C) 2007 Emil Renner Berthing +# Copyright (C) 2007, 2009 Emil Renner Berthing # # mktorrent is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,10 +17,11 @@ #-------------Interesting variables for you to override :)-------------------- -CC ?= cc -CFLAGS ?= -O2 -Wall -INSTALL ?= install -PREFIX ?= /usr/local +# Default settings shown +#CC = cc +#CFLAGS = -O2 -Wall +#INSTALL = install +#PREFIX = /usr/local # Use multiple POSIX threads for calculating hashes. This should be slightly # faster. Much faster on systems with multiple CPUs and fast harddrives. @@ -54,74 +55,10 @@ PREFIX ?= /usr/local # information. #DEBUG = 1 - #-------------Nothing interesting below this line----------------------------- -program := mktorrent -version := 0.5 +program = mktorrent +version = 0.6 HEADERS = mktorrent.h -SRCS := ftw.c init.c sha1.c hash.c output.c main.c -OBJS = $(SRCS:.c=.o) -LIBS := - -ifdef USE_PTHREADS -DEFINES += -DUSE_PTHREADS -SRCS := $(SRCS:hash.c=hash_pthreads.c) -LIBS += -lpthread -endif - -ifdef USE_OPENSSL -DEFINES += -DUSE_OPENSSL -SRCS := $(SRCS:sha1.c=) -LIBS += -lssl -endif - - -ifdef NO_LONG_OPTIONS -DEFINES += -DNO_LONG_OPTIONS -endif - -ifdef NO_HASH_CHECK -DEFINES += -DNO_HASH_CHECK -endif - -ifdef MAX_OPENFD -DEFINES += -DMAX_OPENFD="$(MAX_OPENFD)" -endif - -ifdef DEBUG -DEFINES += -DDEBUG -endif - -override DEFINES += -DVERSION="\"$(version)\"" -override CFLAGS += $(DEFINES) -override LDFLAGS += $(LIBS) - -.PHONY: all strip indent clean install uninstall - -all: $(program) - -%.o : %.c $(HEADERS) - $(CC) $(CFLAGS) -c $< - -$(program): $(OBJS) - $(CC) $(CFLAGS) $^ -o $(program) $(LDFLAGS) - -allinone: $(SRCS) $(HEADERS) - $(CC) $(CFLAGS) -DALLINONE main.c -o $(program) $(LDFLAGS) - -strip: - strip $(program) - -indent: - indent -kr -i8 *.c *.h - -clean: - rm -f $(program) *.o *.c~ *.h~ - -install: $(program) - $(INSTALL) -m755 -D $(program) $(DESTDIR)$(PREFIX)/bin/$(program) - -uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/$(program) +SRCS = ftw.c init.c sha1.c hash.c output.c main.c diff --git a/rules.mk b/rules.mk new file mode 100644 index 0000000..72a212c --- /dev/null +++ b/rules.mk @@ -0,0 +1,44 @@ +# This file is part of mktorrent +# Copyright (C) 2007, 2009 Emil Renner Berthing +# +# mktorrent is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# mktorrent 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +.PHONY: all strip indent clean install uninstall + +all: $(program) + +%.o : %.c $(HEADERS) + $(CC) $(CFLAGS) $(DEFINES) -DVERSION="\"$(version)\"" -c $< + +$(program): $(OBJS) + $(CC) $(CFLAGS) $(OBJS) -o $(program) $(LDFLAGS) $(LIBS) + +allinone: $(SRCS) $(HEADERS) + $(CC) $(CFLAGS) $(DEFINES) -DVERSION="\"$(version)\"" -DALLINONE main.c -o $(program) $(LDFLAGS) $(LIBS) + +strip: + strip $(program) + +indent: + indent -kr -i8 *.c *.h + +clean: + rm -f $(program) *.o *.c~ *.h~ + +install: $(program) + $(INSTALL) -m755 -D $(program) $(DESTDIR)$(PREFIX)/bin/$(program) + +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/$(program)