Sat, 22 Apr 2000 17:34:20 +0200
trunk: changeset 11
Portability fixes
Makefile | file | annotate | diff | comparison | revisions | |
include/libtu/misc.h | file | annotate | diff | comparison | revisions | |
include/libtu/optparser.h | file | annotate | diff | comparison | revisions | |
include/libtu/output.h | file | annotate | diff | comparison | revisions | |
include/libtu/parser.h | file | annotate | diff | comparison | revisions | |
include/libtu/tokenizer.h | file | annotate | diff | comparison | revisions | |
include/libtu/types.h | file | annotate | diff | comparison | revisions | |
rules.mk | file | annotate | diff | comparison | revisions | |
system.mk | file | annotate | diff | comparison | revisions |
--- 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
--- 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 <stdlib.h> #include <stdio.h> @@ -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 */
--- 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 */
--- 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 <stdarg.h> @@ -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 */
--- 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 */
--- 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 <stdio.h> #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 */
--- 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 <sys/types.h> #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 */
--- 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 ######################################
--- 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 -