diff --git a/BSDmakefile b/BSDmakefile index bf6f337..9dec566 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -60,8 +60,8 @@ all: $(program) .SUFFIXES: .o .c .c.o: - $(CC) $(CFLAGS) $(DEFINES) -DPRIoff="\"`./prefix`d\"" -DVERSION="\"$(version)\"" -c $(.IMPSRC) + $(CC) $(CFLAGS) $(DEFINES) -DVERSION="\"$(version)\"" -c $(.IMPSRC) -$(OBJS): $(HEADERS) prefix +$(OBJS): $(HEADERS) .include "rules.mk" diff --git a/GNUmakefile b/GNUmakefile index d041d0e..68c78ee 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -54,13 +54,11 @@ ifdef DEBUG DEFINES += -DDEBUG endif -OFFPRFX = $(shell ./prefix) - OBJS = $(SRCS:.c=.o) all: $(program) -%.o: %.c $(HEADERS) prefix - $(CC) $(CFLAGS) $(DEFINES) -DPRIoff="\"$(OFFPRFX)d\"" -DVERSION="\"$(version)\"" -c $< +%.o: %.c $(HEADERS) + $(CC) $(CFLAGS) $(DEFINES) -DVERSION="\"$(version)\"" -c $< include rules.mk diff --git a/Makefile b/Makefile index d1f5702..998db3f 100644 --- a/Makefile +++ b/Makefile @@ -65,5 +65,5 @@ program = mktorrent version = 1.1 -HEADERS = mktorrent.h +HEADERS = mktorrent.h ll.h SRCS = ftw.c init.c sha1.c hash.c output.c main.c msg.c ll.c diff --git a/prefix.c b/prefix.c deleted file mode 100644 index 20f9895..0000000 --- a/prefix.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -This file is part of mktorrent -Copyright (C) 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 -#include -#include -#include - -#ifndef TYPE -#define TYPE off_t -#endif - -#if __WORDSIZE == 32 && _FILE_OFFSET_BITS == 64 -# define PRIdOFF_T PRId64 -#else -# define PRIdOFF_T PRIdPTR -#endif - -int main() -{ - unsigned int i; - char *prefix[9]; - - for (i = 0; i < 9; i++) - prefix[i] = NULL; - - prefix[1] = "hh"; - prefix[2] = "h"; - - prefix[8] = "ll"; - prefix[sizeof(int)] = ""; - prefix[sizeof(long int)] = "l"; - -#ifdef DEBUG -#define xstr(s) str(s) -#define str(s) #s - -#ifdef _LARGEFILE_SOURCE - fprintf(stderr, "_LARGEFILE_SOURCE is set\n"); -#endif - -#ifdef _FILE_OFFSET_BITS - fprintf(stderr, "_FILE_OFFSET_BITS = %u\n", _FILE_OFFSET_BITS); -#endif - - fprintf(stderr, "__WORDSIZE is %d\n", __WORDSIZE); - fprintf(stderr, "PRIdOFF_T is " PRIdOFF_T "\n"); - fprintf(stderr, "sizeof(int) = %u, %u bits\n", - (u_int) sizeof(int), 8 * (u_int) sizeof(int)); - fprintf(stderr, "sizeof(long int) = %u, %u bits\n", - (u_int) sizeof(long int), 8 * (u_int) sizeof(long int)); - fprintf(stderr, "sizeof(" xstr(TYPE) ") = %u, %u bits\n", - (u_int) sizeof(TYPE), 8 * (u_int) sizeof(TYPE)); -#endif /* DEBUG */ - - printf("%s\n", prefix[sizeof(TYPE)]); - - return EXIT_SUCCESS; -} diff --git a/rules.mk b/rules.mk index 5960822..1b0b42d 100644 --- a/rules.mk +++ b/rules.mk @@ -17,14 +17,11 @@ .PHONY: strip indent clean install uninstall -prefix: prefix.c - $(CC) $(CFLAGS) $(DEFINES) $(LDFLAGS) $< -o $@ - $(program): $(OBJS) $(CC) $(CFLAGS) $(OBJS) -o $(program) $(LDFLAGS) $(LIBS) -allinone: $(SRCS) $(HEADERS) prefix - $(CC) $(CFLAGS) $(DEFINES) -DPRIoff="\"`./prefix`d\"" -DVERSION="\"$(version)\"" -DALLINONE main.c -o $(program) $(LDFLAGS) $(LIBS) +allinone: $(SRCS) $(HEADERS) + $(CC) $(CFLAGS) $(DEFINES) -DVERSION="\"$(version)\"" -DALLINONE main.c -o $(program) $(LDFLAGS) $(LIBS) strip: strip $(program) @@ -33,7 +30,7 @@ indent: indent -kr -i8 *.c *.h clean: - rm -f $(program) prefix *.o *.c~ *.h~ + rm -f $(program) *.o *.c~ *.h~ install: $(program) $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin