-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split Makefile for use with both GNU and BSD make
- Loading branch information
Showing
4 changed files
with
163 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |