move libc/ headers to include/ , add lib/

This commit is contained in:
Kelvin Sherlock 2016-07-25 16:57:33 -04:00
parent a1baaf5f50
commit 4fc03aab47
15 changed files with 61 additions and 14 deletions

View File

@ -5,7 +5,7 @@
#include <ctype.h> #include <ctype.h>
#include <Processes.h> #include <Processes.h>
#include "libc/libc.h" #include <libc.h>
#define msizeof(type, member) sizeof( ((type *)0)->member) #define msizeof(type, member) sizeof( ((type *)0)->member)

View File

@ -3,7 +3,7 @@
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include "libc/libc.h" #include <libc.h>
unsigned long GlobalAddress(const char *name, int *numeric) unsigned long GlobalAddress(const char *name, int *numeric)
{ {

32
include/sys/cdefs.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
#define __const const
#define __restrict
#define __signed signed
#define __volatile volatile
#if defined(__cplusplus)
#define __inline inline
#else
#define __inline
#endif
#define __dead2
#define __pure2
#define __unused
#define __used
#define __deprecated
#define __unavailable
#define __dead
#define __pure
#endif

View File

@ -110,6 +110,11 @@ typedef unsigned long ulong32;
#define LTC_ARGCHKVD(x) LTC_ARGCHK(x) #define LTC_ARGCHKVD(x) LTC_ARGCHK(x)
#define LTC_MD2
#define LTC_MD4
#define LTC_MD5
#define LTC_SHA1
//#include <tomcrypt_cfg.h> //#include <tomcrypt_cfg.h>
//#include <tomcrypt_macros.h> //#include <tomcrypt_macros.h>
//#include <tomcrypt_cipher.h> //#include <tomcrypt_cipher.h>

View File

@ -14,7 +14,7 @@ LDFLAGS = -w -c 'MPS ' -t MPST \
-sn STDIO=Main -sn INTENV=Main -sn %A5Init=Main -sn STDIO=Main -sn INTENV=Main -sn %A5Init=Main
LIBFLAGS = -P LIBFLAGS = -P
SCFLAGS = -P -I libc/ -I ./ SCFLAGS = -P -I include/
# MPW 3.5 # MPW 3.5
@ -36,7 +36,10 @@ all: $(TARGETS)
clean: clean:
rm -f *.o rm -f *.o
rm -f $(TARGETS) rm -f $(TARGETS)
rm -f libc/libc libc/*.o rm -f lib/libc libc/*.o
rm -f lib/*
rm -f libtomcrypt/src/hashes/*.o
dist/Tools.tgz: $(TARGETS) dist/Tools.tgz: $(TARGETS)
cp $^ dist/Tools/ cp $^ dist/Tools/
@ -47,7 +50,10 @@ dist/Tools.tgz: $(TARGETS)
install: $(TARGETS) install: $(TARGETS)
cp $^ ~/mpw/Tools/ cp $^ ~/mpw/Tools/
libc/libc: libc/strcasecmp.c.o libc/_getprogname.c.o libc/err.c.o libc/getopt.c.o libc/basename.c.o lib:
mkdir lib
lib/libc: libc/strcasecmp.c.o libc/_getprogname.c.o libc/err.c.o libc/getopt.c.o libc/basename.c.o | lib
$(MPW) Lib $(LIBFLAGS) -o $@ $^ $(MPW) Lib $(LIBFLAGS) -o $@ $^
GetEnv: GetEnv.c.o GetEnv: GetEnv.c.o
@ -78,14 +84,14 @@ ListRez: ListRez.c.o
ListRezIIgs: ListRezIIgs.c.o ListRezIIgs: ListRezIIgs.c.o
$(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS) $(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS)
LSeg: LSeg.c.o libc/libc LSeg: LSeg.c.o lib/libc
$(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS) $(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS)
MakeEnums: MakeEnums.c.o libc/libc MakeEnums: MakeEnums.c.o lib/libc
$(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS) $(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS)
ReadGlobal: ReadGlobal.c.o libc/libc ReadGlobal: ReadGlobal.c.o lib/libc
$(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS) $(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS)
Parameters: Parameters.c.o Parameters: Parameters.c.o
@ -94,16 +100,21 @@ Parameters: Parameters.c.o
Echo: Echo.c.o Echo: Echo.c.o
$(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS) $(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS)
md5 : md5.c.o libtomcrypt/src/hashes/md5.c.o
md5 : md5.c.o lib/libtomcrypt
$(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS) $(MPW) Link $(LDFLAGS) -o $@ $^ $(LIBS)
md5.c.o : md5.c md5.c.o : md5.c
$(MPW) SC -P -I . -I libtomcrypt/src/headers $< -o $@ $(MPW) SC $(SCFLAGS) -I libtomcrypt/src/headers $< -o $@
libtomcrypt/src/hashes/md5.c.o : libtomcrypt/src/hashes/md5.c LTC_H = libtomcrypt/src/hashes/
$(MPW) SC -P -I . -I libtomcrypt/src/headers -d LTC_MD5 $< -o $@ lib/libtomcrypt : $(LTC_H)/md2.c.o $(LTC_H)/md4.c.o $(LTC_H)/md5.c.o $(LTC_H)/sha1.c.o | lib
$(MPW) Lib $(LIBFLAGS) -o $@ $^
$(LTC_H)%.c.o : $(LTC_H)%.c
$(MPW) SC $(SCFLAGS) -I libtomcrypt/src/headers/ $< -o $@
#SetFile.c : SetFile.rl #SetFile.c : SetFile.rl
# ragel -G2 -p -m -o $@ $< # ragel -G2 -p -m -o $@ $<

3
md5.c
View File

@ -2,8 +2,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#define LTC_MD5 #include <tomcrypt.h>
#include "tomcrypt.h"
const char *unhash(const unsigned char *hash) { const char *unhash(const unsigned char *hash) {