# HG changeset patch # User tuomov # Date 956417660 -7200 # Node ID c1994196683fa0df9d322700d27dde223c89c1e6 # Parent 6b608d438597107bd4ae5f705d2d986fb55597c8 trunk: changeset 11 Portability fixes diff -r 6b608d438597 -r c1994196683f Makefile --- a/Makefile Wed Apr 19 22:44:45 2000 +0200 +++ b/Makefile Sat Apr 22 17:34:20 2000 +0200 @@ -28,12 +28,19 @@ libtu.a: $(OBJS) $(AR) $(AR_FLAGS) $@ $+ -%: %.c libtu.a - $(CC) $(CC_FLAGS) $+ -L. -ltu -lm -o $@ +tester: tester.c libtu.a + $(CC) $(CC_FLAGS) $< -L. -ltu -lm -o $@ + +tester2: tester2.c libtu.a + $(CC) $(CC_FLAGS) $< -L. -ltu -lm -o $@ + +tester3: tester3.c libtu.a + $(CC) $(CC_FLAGS) $< -L. -ltu -lm -o $@ _install: $(INSTALL) -d $(LIBDIR) $(INSTALL) -d $(INCDIR) $(INSTALL) -m $(DATA_MODE) libtu.a $(LIBDIR) - $(INSTALL) -m $(DATA_MODE) include/libtu/*.h $(INCDIR) - + for i in include/libtu/*.h; do \ + $(INSTALL) -m $(DATA_MODE) $$i $(INCDIR); \ + done diff -r 6b608d438597 -r c1994196683f include/libtu/misc.h --- a/include/libtu/misc.h Wed Apr 19 22:44:45 2000 +0200 +++ b/include/libtu/misc.h Sat Apr 22 17:34:20 2000 +0200 @@ -7,8 +7,8 @@ * See the included file LICENSE for details. */ -#ifndef __LIBTU_MISC_H -#define __LIBTU_MISC_H +#ifndef LIBTU_MISC_H +#define LIBTU_MISC_H #include #include @@ -38,4 +38,4 @@ extern bool readf(FILE *fd, void *buf, size_t n); extern bool writef(FILE *fd, const void *buf, size_t n); -#endif /* __LIBTU_MISC_H */ +#endif /* LIBTU_MISC_H */ diff -r 6b608d438597 -r c1994196683f include/libtu/optparser.h --- a/include/libtu/optparser.h Wed Apr 19 22:44:45 2000 +0200 +++ b/include/libtu/optparser.h Sat Apr 22 17:34:20 2000 +0200 @@ -7,8 +7,8 @@ * See the included file LICENSE for details. */ -#ifndef __LIBTU_OPTPARSER_H -#define __LIBTU_OPTPARSER_H +#ifndef LIBTU_OPTPARSER_H +#define LIBTU_OPTPARSER_H #include "types.h" @@ -65,4 +65,4 @@ extern const char* optparser_get_arg(); extern void optparser_print_error(); -#endif /* __LIBTU_OPTPARSER_H */ +#endif /* LIBTU_OPTPARSER_H */ diff -r 6b608d438597 -r c1994196683f include/libtu/output.h --- a/include/libtu/output.h Wed Apr 19 22:44:45 2000 +0200 +++ b/include/libtu/output.h Sat Apr 22 17:34:20 2000 +0200 @@ -7,8 +7,8 @@ * See the included file LICENSE for details. */ -#ifndef __LIBTU_OUTPUT_H -#define __LIBTU_OUTPUT_H +#ifndef LIBTU_OUTPUT_H +#define LIBTU_OUTPUT_H #include @@ -47,4 +47,4 @@ extern void warn_err_obj(const char *obj); extern void warn_err_obj_line(const char *obj, int line); -#endif /* __LIBTU_OUTPUT_H */ +#endif /* LIBTU_OUTPUT_H */ diff -r 6b608d438597 -r c1994196683f include/libtu/parser.h --- a/include/libtu/parser.h Wed Apr 19 22:44:45 2000 +0200 +++ b/include/libtu/parser.h Sat Apr 22 17:34:20 2000 +0200 @@ -7,8 +7,8 @@ * See the included file LICENSE for details. */ -#ifndef __LIBTU_PARSER_H -#define __LIBTU_PARSER_H +#ifndef LIBTU_PARSER_H +#define LIBTU_PARSER_H #include "tokenizer.h" @@ -42,4 +42,4 @@ extern bool parse_config(const char *fname, const ConfOpt *options, int flags); extern bool parse_config_file(FILE *file, const ConfOpt *options, int flags); -#endif /* __LIBTU_PARSER_H */ +#endif /* LIBTU_PARSER_H */ diff -r 6b608d438597 -r c1994196683f include/libtu/tokenizer.h --- a/include/libtu/tokenizer.h Wed Apr 19 22:44:45 2000 +0200 +++ b/include/libtu/tokenizer.h Sat Apr 22 17:34:20 2000 +0200 @@ -7,8 +7,8 @@ * See the included file LICENSE for details. */ -#ifndef __LIBTU_TOKENIZER_H -#define __LIBTU_TOKENIZER_H +#ifndef LIBTU_TOKENIZER_H +#define LIBTU_TOKENIZER_H #include #include "types.h" @@ -188,4 +188,4 @@ extern bool tokz_pushf_file(Tokenizer *tokz, FILE *file); extern bool tokz_popf(Tokenizer *tokz); -#endif /* __LIBTU_TOKENIZER_H */ +#endif /* LIBTU_TOKENIZER_H */ diff -r 6b608d438597 -r c1994196683f include/libtu/types.h --- a/include/libtu/types.h Wed Apr 19 22:44:45 2000 +0200 +++ b/include/libtu/types.h Sat Apr 22 17:34:20 2000 +0200 @@ -7,21 +7,21 @@ * See the included file LICENSE for details. */ -#ifndef __LIBTU_TYPES_H -#define __LIBTU_TYPES_H +#ifndef LIBTU_TYPES_H +#define LIBTU_TYPES_H #include #ifndef TRUE - #define TRUE 1 +#define TRUE 1 #endif #ifndef FALSE - #define FALSE 0 +#define FALSE 0 #endif #ifndef NULL - #define NULL ((void*)0) +#define NULL ((void*)0) #endif #ifndef LIBTU_TYPEDEF_UXXX @@ -32,49 +32,55 @@ * autoconf or similar methods. ==> Just stick to #define. :-( */ - #ifndef uchar - #define uchar unsigned char - #endif - #ifndef ushort - #define ushort unsigned short - #endif - #ifndef uint - #define uint unsigned int - #endif - #ifndef ulong - #define ulong unsigned long - #endif +#ifndef uchar +#define uchar unsigned char +#endif + +#ifndef ushort +#define ushort unsigned short +#endif + +#ifndef uint +#define uint unsigned int +#endif + +#ifndef ulong +#define ulong unsigned long +#endif #else /* LIBTU_TYPEDEF_UXXX */ - #ifndef uchar - typedef unsigned char uchar; - #endif - #ifndef ushort - typedef unsigned short ushort; - #endif - #ifndef uint - typedef unsigned int uint; - #endif - #ifndef ulong - typedef unsigned long ulong; - #endif +#ifndef uchar +typedef unsigned char uchar; +#endif + +#ifndef ushort +typedef unsigned short ushort; +#endif + +#ifndef uint +typedef unsigned int uint; +#endif + +#ifndef ulong +typedef unsigned long ulong; +#endif #endif /* LIBTU_TYPEDEF_UXXX */ #ifndef LIBTU_TYPEDEF_BOOL - #ifndef bool - #define bool int - #endif +#ifndef bool +#define bool int +#endif #else /* LIBTU_TYPEDEF_BOOL */ - #ifndef bool - typedef int bool; - #endif +#ifndef bool +typedef int bool; +#endif #endif /* LIBTU_TYPEDEF_BOOL */ -#endif /* __LIBTU_TYPES_H */ +#endif /* LIBTU_TYPES_H */ diff -r 6b608d438597 -r c1994196683f rules.mk --- a/rules.mk Wed Apr 19 22:44:45 2000 +0200 +++ b/rules.mk Sat Apr 22 17:34:20 2000 +0200 @@ -2,8 +2,6 @@ ## Some make rules ## -DEPEND_FILE=.depend - ###################################### ifdef SUBDIRS @@ -50,7 +48,7 @@ rm -f $(TARGETS) _depend: - $(CC) -M $(CC_FLAGS) *.c > $(DEPEND_FILE) + $(MAKE_DEPEND) *.c ###################################### diff -r 6b608d438597 -r c1994196683f system.mk --- a/system.mk Wed Apr 19 22:44:45 2000 +0200 +++ b/system.mk Sat Apr 22 17:34:20 2000 +0200 @@ -9,8 +9,8 @@ PREFIX=/usr/local -#INCLUDES += -I$(PREFIX)/include -#LIBS += -L$(PREFIX)/lib +#EXTRA_INCLUDES = -I$(PREFIX)/include +#EXTRA_LIBS = -L$(PREFIX)/lib ## @@ -34,7 +34,10 @@ CC=gcc ANSI_SOURCE=-ansi +# gnu libc XOPEN_SOURCE=-ansi -D_XOPEN_SOURCE +# most other systems +#XOPEN_SOURCE=-ansi -D__EXTENSIONS__ # Same as '-Wall -pedantic-errors' without '-Wunused' as callbacks often # have unused variables. @@ -42,8 +45,16 @@ -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized \ -Wparentheses -pedantic-errors -CC_FLAGS=-g -O2 $(WARN) $(DEFINES) $(INCLUDES) -LINK_FLAGS=-g $(LIBS) +CC_FLAGS=-g -O2 $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) +LINK_FLAGS=-g $(LIBS) $(EXTRA_LIBS) + + +## +## make depend +## + +DEPEND_FILE=.depend +MAKE_DEPEND=$(CC) -M $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) > $(DEPEND_FILE) ## @@ -59,11 +70,10 @@ ## INSTALL=install -c -# bsdinst or bsdinst.sh should do the job under IRIX. +# bsdinst or bsdinst.sh should do the job under IRIX. In theory. #INSTALL=bsdinst -c BIN_MODE=755 DATA_MODE=664 STRIP=strip -