From 166060cfad61e483c4bd5ec0a1c8dfbc2d00c6ff Mon Sep 17 00:00:00 2001 From: Eric Pooch Date: Mon, 12 Mar 2018 21:52:20 -0700 Subject: [PATCH] Updates to documentation and README formatting. --- .gitignore | 1 + README.md | 124 +++++++++++++++++ head_support.h.patch | 15 --- head_support.patch | 311 ------------------------------------------- ports/mac/Makefile | 5 +- 5 files changed, 129 insertions(+), 327 deletions(-) create mode 100644 README.md delete mode 100644 head_support.h.patch delete mode 100644 head_support.patch diff --git a/.gitignore b/.gitignore index c8da1ca..7b39416 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store *.o +*.swp /ports/mac/ElWhip-HTTPD /ports/mac/ElWhip\ 0.* /ports/win32/msvc/Debug diff --git a/README.md b/README.md new file mode 100644 index 0000000..db02762 --- /dev/null +++ b/README.md @@ -0,0 +1,124 @@ +# ElWhip 0.07 + +This is a port of the lwip network stack and PPP over serial protocol for early Macintosh computers. It has been tested on a Macintosh SE running System 7.1 and a virtual Macintosh 128K with 64K ROMs. It will not be able to close the PPP session on quit on a Mac 128K due to memory limitations. + +## Web server configuration: +The web server does not require the HTML files to have the HTTP headers on the top. Only files with an extension will be loaded by the server (eg: ".html"). + +## PPP configuration: +On Mac OS X 10.4 (and probably later): +### /etc/ppp/options file: + +--- +``` +asyncmap 0 +proxyarp +lock +``` +--- + +### /etc/ppp/options.cu.usbserial file: + +Replace cu.usbserial with the name of your serial device in /dev/ +use the correct IP addresses for your setup + +--- +``` +# Baud rate of the connection. ElWhip uses 19200. +19200 +# Don't use the modem control lines. +local +# Try to reopen the connection it it is terminated. +persist +# Don't require the peer to authenticate. +noauth +# Disable negotiation of Van Jacobson style IP header compression. +novj +# IP address to be given to peer. +:192.168.11.130 +# IP address of the DNS server for the peer. +ms-dns 192.168.11.1 +# Enables IP forwarding on linux +ktune +# Add an entry for the peer to this system's ARP table. +proxyarp +``` +--- + +### Running PPP from the command line: +$ pppd -d cu.usbserial +(Replace cu.usbserial with the name of your serial device) + +### Forwarding requests from LAN on Mac OS X: +$ sudo sysctl -w net.inet.ip.forwarding=1 + +## Running ElWhip: +Just double-click the application once the modem port is connected to a computer running PPP. The application will try to negotiate a connection. Within a few seconds you should see the PPP phase increase to 7 and see the IP address information that was negotiated. A few seconds later, the web server will start. + +## Connecting to ElWhip: +From an appropriately networked computer, you can open a web browser and connect to the website. + + +--- +Copyrights: + +ElWhip Copyright (c) 2014, 2015 Eric Pooch + +--- +``` +/* lwIP is licenced under the BSD licence: + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Adam Dunkels + * + */ +***************************************************************************** +* Point to Point Protocol. + * + * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. + * + * "This product includes software developed by Computing Services + * at Carnegie Mellon University (http://www.cmu.edu/computing/)." + * +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 Global Election Systems Inc. +* +* +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*************************************************************************** +``` diff --git a/head_support.h.patch b/head_support.h.patch deleted file mode 100644 index 527e31c..0000000 --- a/head_support.h.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/apps/httpserver_raw/httpd.h b/apps/httpserver_raw/httpd.h -index 3962f72..e0a9d18 100644 ---- a/apps/httpserver_raw/httpd.h -+++ b/apps/httpserver_raw/httpd.h -@@ -59,6 +59,10 @@ extern "C" { - #define LWIP_HTTPD_SUPPORT_POST 0 - #endif - -+/** Set this to 1 to support HTTP HEAD */ -+#ifndef LWIP_HTTPD_SUPPORT_HEAD -+#define LWIP_HTTPD_SUPPORT_HEAD 0 -+#endif - - #if LWIP_HTTPD_CGI - diff --git a/head_support.patch b/head_support.patch deleted file mode 100644 index 59e8deb..0000000 --- a/head_support.patch +++ /dev/null @@ -1,311 +0,0 @@ -diff --git a/apps/httpserver_raw/httpd.c b/apps/httpserver_raw/httpd.c -index 772b179..b6199a4 100644 ---- a/apps/httpserver_raw/httpd.c -+++ b/apps/httpserver_raw/httpd.c -@@ -317,6 +317,17 @@ static char http_post_response_filename[LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN+1]; - #define NUM_FILE_HDR_STRINGS 3 - #endif /* LWIP_HTTPD_DYNAMIC_HEADERS */ - -+#if LWIP_HTTPD_SUPPORT_HEAD || LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_V09 -+enum request_method { -+ METHOD_UNK, /* Unknown method */ -+ METHOD_GET, /* HTTP 1.0 spec 8.1 - GET */ -+ METHOD_HEAD, /* HTTP 1.0 spec 8.2 - HEAD */ -+ METHOD_POST, /* HTTP 1.0 spec 8.3 - POST */ -+ METHOD_V09_GET = 9 /* HTTP 0.9 - GET */ -+}; -+#endif /* LWIP_HTTPD_SUPPORT_HEAD || LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_V09*/ -+ -+ - #if LWIP_HTTPD_SSI - - #define HTTPD_LAST_TAG_PART 0xFFFF -@@ -370,6 +381,9 @@ struct http_state { - #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE - u8_t keepalive; - #endif /* LWIP_HTTPD_SUPPORT_11_KEEPALIVE */ -+#if LWIP_HTTPD_SUPPORT_HEAD || LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_V09 -+ int method; -+#endif /* LWIP_HTTPD_SUPPORT_HEAD || LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_V09 */ - #if LWIP_HTTPD_SSI - struct http_ssi_state *ssi; - #endif /* LWIP_HTTPD_SSI */ -@@ -398,8 +412,8 @@ struct http_state { - - static err_t http_close_conn(struct tcp_pcb *pcb, struct http_state *hs); - static err_t http_close_or_abort_conn(struct tcp_pcb *pcb, struct http_state *hs, u8_t abort_conn); --static err_t http_find_file(struct http_state *hs, const char *uri, int is_09); --static err_t http_init_file(struct http_state *hs, struct fs_file *file, int is_09, const char *uri, u8_t tag_check); -+static err_t http_find_file(struct http_state *hs, const char *uri); -+static err_t http_init_file(struct http_state *hs, struct fs_file *file, const char *uri, u8_t tag_check); - static err_t http_poll(void *arg, struct tcp_pcb *pcb); - static u8_t http_check_eof(struct tcp_pcb *pcb, struct http_state *hs); - #if LWIP_HTTPD_FS_ASYNC_READ -@@ -706,7 +720,6 @@ http_close_or_abort_conn(struct tcp_pcb *pcb, struct http_state *hs, u8_t abort_ - } - #endif /* LWIP_HTTPD_SUPPORT_POST*/ - -- - tcp_arg(pcb, NULL); - tcp_recv(pcb, NULL); - tcp_err(pcb, NULL); -@@ -1620,7 +1633,7 @@ http_find_error_file(struct http_state *hs, u16_t error_nr) - } - } - } -- return http_init_file(hs, &hs->file_handle, 0, NULL, 0); -+ return http_init_file(hs, &hs->file_handle, NULL, 0); - } - #else /* LWIP_HTTPD_SUPPORT_EXTSTATUS */ - #define http_find_error_file(hs, error_nr) ERR_ARG -@@ -1677,7 +1690,7 @@ http_handle_post_finished(struct http_state *hs) - /* NULL-terminate the buffer */ - http_post_response_filename[0] = 0; - httpd_post_finished(hs, http_post_response_filename, LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN); -- return http_find_file(hs, http_post_response_filename, 0); -+ return http_find_file(hs, http_post_response_filename); - } - - /** Pass received POST body data to the application and correctly handle -@@ -1706,11 +1719,11 @@ http_post_rxpbuf(struct http_state *hs, struct pbuf *p) - hs->post_content_len_left = 0; - } - if (hs->post_content_len_left == 0) { --#if LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND -+#if LWIP_HTTPD_POST_MANUAL_WND - if (hs->unrecved_bytes != 0) { - return ERR_OK; - } --#endif /* LWIP_HTTPD_SUPPORT_POST && LWIP_HTTPD_POST_MANUAL_WND */ -+#endif /* LWIP_HTTPD_POST_MANUAL_WND */ - /* application error or POST finished */ - return http_handle_post_finished(hs); - } -@@ -1792,7 +1805,7 @@ http_post_request(struct pbuf *inp, struct http_state *hs, - } - } else { - /* return file passed from application */ -- return http_find_file(hs, http_post_response_filename, 0); -+ return http_find_file(hs, http_post_response_filename); - } - } else { - LWIP_DEBUGF(HTTPD_DEBUG, ("POST received invalid Content-Length: %s\n", -@@ -1946,11 +1959,7 @@ http_parse_request(struct pbuf *inp, struct http_state *hs, struct tcp_pcb *pcb) - if (data_len >= MIN_REQ_LEN) { - /* wait for CRLF before parsing anything */ - crlf = strnstr(data, CRLF, data_len); -- if (crlf != NULL) { --#if LWIP_HTTPD_SUPPORT_POST -- int is_post = 0; --#endif /* LWIP_HTTPD_SUPPORT_POST */ -- int is_09 = 0; -+ if (crlf != NULL) { - char *sp1, *sp2; - u16_t left_len, uri_len; - LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("CRLF received, parsing request\n")); -@@ -1959,16 +1968,27 @@ http_parse_request(struct pbuf *inp, struct http_state *hs, struct tcp_pcb *pcb) - sp1 = data + 3; - /* received GET request */ - LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Received GET request\"\n")); -+#if LWIP_HTTPD_SUPPORT_HEAD || LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_V09 -+ hs->method = METHOD_GET; -+#endif /* LWIP_HTTPD_SUPPORT_HEAD || LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_V09 */ -+#if LWIP_HTTPD_SUPPORT_HEAD -+ } else if (!strncmp(data, "HEAD ", 5)) { -+ /* store request type */ -+ hs->method = METHOD_HEAD; -+ sp1 = data + 4; -+ /* received HEAD request */ -+ LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Received HEAD request\n")); -+#endif /* LWIP_HTTPD_SUPPORT_HEAD */ - #if LWIP_HTTPD_SUPPORT_POST - } else if (!strncmp(data, "POST ", 5)) { - /* store request type */ -- is_post = 1; -+ hs->method = METHOD_POST; - sp1 = data + 4; -- /* received GET request */ -+ /* received POST request */ - LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Received POST request\n")); - #endif /* LWIP_HTTPD_SUPPORT_POST */ - } else { -- /* null-terminate the METHOD (pbuf is freed anyway wen returning) */ -+ /* null-terminate the METHOD (pbuf is freed anyway when returning) */ - data[4] = 0; - /* unsupported method! */ - LWIP_DEBUGF(HTTPD_DEBUG, ("Unsupported request method (not implemented): \"%s\"\n", -@@ -1982,32 +2002,33 @@ http_parse_request(struct pbuf *inp, struct http_state *hs, struct tcp_pcb *pcb) - if (sp2 == NULL) { - /* HTTP 0.9: respond with correct protocol version */ - sp2 = strnstr(sp1 + 1, CRLF, left_len); -- is_09 = 1; --#if LWIP_HTTPD_SUPPORT_POST -- if (is_post) { -- /* HTTP/0.9 does not support POST */ -+#if LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_HEAD -+ if (hs->method != METHOD_GET) { -+ /* HTTP/0.9 only supports GET method */ - goto badrequest; - } --#endif /* LWIP_HTTPD_SUPPORT_POST */ -+#endif /* LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_HEAD */ -+ hs->method = METHOD_V09_GET; - } - #endif /* LWIP_HTTPD_SUPPORT_V09 */ -+ - uri_len = sp2 - (sp1 + 1); - if ((sp2 != 0) && (sp2 > sp1)) { - /* wait for CRLFCRLF (indicating end of HTTP headers) before parsing anything */ - if (strnstr(data, CRLF CRLF, data_len) != NULL) { - char *uri = sp1 + 1; - #if LWIP_HTTPD_SUPPORT_11_KEEPALIVE -- if (!is_09 && strnstr(data, HTTP11_CONNECTIONKEEPALIVE, data_len)) { -+ if ((hs->method != METHOD_V09_GET && strnstr(data, HTTP11_CONNECTIONKEEPALIVE, data_len)) { - hs->keepalive = 1; - } - #endif /* LWIP_HTTPD_SUPPORT_11_KEEPALIVE */ -- /* null-terminate the METHOD (pbuf is freed anyway wen returning) */ -+ /* null-terminate the METHOD (pbuf is freed anyway when returning) */ - *sp1 = 0; - uri[uri_len] = 0; - LWIP_DEBUGF(HTTPD_DEBUG, ("Received \"%s\" request for URI: \"%s\"\n", - data, uri)); - #if LWIP_HTTPD_SUPPORT_POST -- if (is_post) { -+ if (method == METHOD_POST) { - #if LWIP_HTTPD_SUPPORT_REQUESTLIST - struct pbuf *q = hs->req; - #else /* LWIP_HTTPD_SUPPORT_REQUESTLIST */ -@@ -2027,7 +2048,7 @@ http_parse_request(struct pbuf *inp, struct http_state *hs, struct tcp_pcb *pcb) - } else - #endif /* LWIP_HTTPD_SUPPORT_POST */ - { -- return http_find_file(hs, uri, is_09); -+ return http_find_file(hs, uri); - } - } - } else { -@@ -2045,9 +2066,9 @@ http_parse_request(struct pbuf *inp, struct http_state *hs, struct tcp_pcb *pcb) - } else - #endif /* LWIP_HTTPD_SUPPORT_REQUESTLIST */ - { --#if LWIP_HTTPD_SUPPORT_POST -+#if LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_HEAD - badrequest: --#endif /* LWIP_HTTPD_SUPPORT_POST */ -+#endif /* LWIP_HTTPD_SUPPORT_POST || LWIP_HTTPD_SUPPORT_HEAD */ - LWIP_DEBUGF(HTTPD_DEBUG, ("bad request\n")); - /* could not parse request */ - return http_find_error_file(hs, 400); -@@ -2059,12 +2080,11 @@ badrequest: - * - * @param hs the connection state - * @param uri the HTTP header URI -- * @param is_09 1 if the request is HTTP/0.9 (no HTTP headers in response) - * @return ERR_OK if file was found and hs has been initialized correctly - * another err_t otherwise - */ - static err_t --http_find_file(struct http_state *hs, const char *uri, int is_09) -+http_find_file(struct http_state *hs, const char *uri) - { - size_t loop; - struct fs_file *file = NULL; -@@ -2154,7 +2174,7 @@ http_find_file(struct http_state *hs, const char *uri, int is_09) - } - #endif /* LWIP_HTTPD_SSI */ - } -- return http_init_file(hs, file, is_09, uri, tag_check); -+ return http_init_file(hs, file, uri, tag_check); - } - - /** Initialize a http connection with a file to send (if found). -@@ -2162,14 +2182,13 @@ http_find_file(struct http_state *hs, const char *uri, int is_09) - * - * @param hs http connection state - * @param file file structure to send (or NULL if not found) -- * @param is_09 1 if the request is HTTP/0.9 (no HTTP headers in response) - * @param uri the HTTP header URI - * @param tag_check enable SSI tag checking - * @return ERR_OK if file was found and hs has been initialized correctly - * another err_t otherwise - */ - static err_t --http_init_file(struct http_state *hs, struct fs_file *file, int is_09, const char *uri, u8_t tag_check) -+http_init_file(struct http_state *hs, struct fs_file *file, const char *uri, u8_t tag_check) - { - if (file != NULL) { - /* file opened, initialise struct http_state */ -@@ -2192,25 +2211,41 @@ http_init_file(struct http_state *hs, struct fs_file *file, int is_09, const cha - hs->file = (char*)file->data; - LWIP_ASSERT("File length must be positive!", (file->len >= 0)); - hs->left = file->len; -+#if LWIP_HTTPD_DYNAMIC_FILE_READ -+ if (hs->file == NULL) { -+ /* Causes http_check_eof() to be called which will read the data. */ -+ hs->left = 0; -+ } -+#endif - hs->retries = 0; - #if LWIP_HTTPD_TIMING - hs->time_started = sys_now(); - #endif /* LWIP_HTTPD_TIMING */ - #if !LWIP_HTTPD_DYNAMIC_HEADERS - LWIP_ASSERT("HTTP headers not included in file system", hs->handle->http_header_included); --#endif /* !LWIP_HTTPD_DYNAMIC_HEADERS */ -+#endif /* !LWIP_HTTPD_DYNAMIC_HEADERS */ -+#if LWIP_HTTPD_SUPPORT_V09 || LWIP_HTTPD_SUPPORT_HEAD -+ if ( hs->handle->http_header_included && hs->method != METHOD_GET) { -+ /* Search for the end of the header. */ -+ char *head_end = strnstr(hs->file, CRLF CRLF, hs->left); -+ size_t diff = head_end + 4 - hs->file; -+ if (head_end == NULL) { -+ LWIP_DEBUGF(HTTPD_DEBUG, ("Expected HTTP header, but couldn't find it.\n")); -+ hs->handle->http_header_included = 0; - #if LWIP_HTTPD_SUPPORT_V09 -- if (hs->handle->http_header_included && is_09) { -- /* HTTP/0.9 responses are sent without HTTP header, -- search for the end of the header. */ -- char *file_start = strnstr(hs->file, CRLF CRLF, hs->left); -- if (file_start != NULL) { -- size_t diff = file_start + 4 - hs->file; -- hs->file += diff; -- hs->left -= (u32_t)diff; -- } -- } -+ } else if (hs->method == METHOD_V09_GET) { -+ /* HTTP/0.9 responses are sent without HTTP header. */ -+ hs->file += diff; -+ hs->left -= (u32_t)diff; - #endif /* LWIP_HTTPD_SUPPORT_V09*/ -+#if LWIP_HTTPD_SUPPORT_HEAD -+ } else if (hs->method == METHOD_HEAD) { -+ /* HEAD method responses are sent with only HTTP header. */ -+ hs->left = (u32_t)diff; -+#endif /* LWIP_HTTPD_SUPPORT_HEAD*/ -+ } -+ } -+#endif /* LWIP_HTTPD_SUPPORT_V09 || LWIP_HTTPD_SUPPORT_HEAD*/ - } else { - hs->handle = NULL; - hs->file = NULL; -@@ -2221,7 +2256,18 @@ http_init_file(struct http_state *hs, struct fs_file *file, int is_09, const cha - /* Determine the HTTP headers to send based on the file extension of - * the requested URI. */ - if ((hs->handle == NULL) || !hs->handle->http_header_included) { -- get_http_headers(hs, (char*)uri); -+#if LWIP_HTTPD_SUPPORT_V09 -+ if (hs->method != METHOD_V09_GET) -+ /* Don't load the header. */ -+#endif /* LWIP_HTTPD_SUPPORT_V09*/ -+ get_http_headers(hs, (char*)uri); -+#if LWIP_HTTPD_SUPPORT_HEAD -+ if (hs->method == METHOD_HEAD) { -+ /* Just the the header, not the file. */ -+ hs->left = 0; -+ hs->handle->len = 0; -+ } -+#endif /* LWIP_HTTPD_SUPPORT_HEAD*/ - } - #else /* LWIP_HTTPD_DYNAMIC_HEADERS */ - LWIP_UNUSED_ARG(uri); diff --git a/ports/mac/Makefile b/ports/mac/Makefile index 2097be4..7c5bd2b 100644 --- a/ports/mac/Makefile +++ b/ports/mac/Makefile @@ -1 +1,4 @@ -# File: Makefile # Target: TestEcho (MPW 3.1 libraries), ElWhip (MPW 3.1 libraries) # Created: Sunday, November 29, 2009 11:11:08 PM # # ElWhip uses Link (rather than iLink) and the Libraries and Interfaces from MPW 3.1 # to build a program to run on System 6.08 and earlier. # Copy (or make an Alias of) the Interfaces:CIncludes and Libraries folders from MPW 3.1 # and name them Interfaces:CIncludes-3.1 and Libraries-3.1 MAKEFILE = MakeFile ¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified ObjDir = : SrcDir = ::::lwip:src: IncDir = {SrcDir}include: APISrc = "{SrcDir}api:" CoreSrc = "{SrcDir}core:" IPV4Src = "{CoreSrc}ipv4:" NetISrc = "{SrcDir}netif:" PPPISrc = "{NetISrc}ppp:" ContribDir = ::: PortsDir = {ContribDir}ports: AppsDir = {ContribDir}apps: MacSrc = {PortsDir}mac: # Use the includes from MPW 3.1 Includes = ¶ -i "{CIncludes}:CIncludes-3.1:" ¶ -i {MacSrc}include: ¶ -i {MacSrc}include:arch: ¶ -i {AppsDir} ¶ -i {IncDir} ¶ -i {IncDir}lwip: ¶ -i {IncDir}ipv4: ¶ -i {IncDir}ipv6: ¶ -i {IncDir}netif: ¶ -i {AppsDir}httpserver_raw: ¶ -i {IncDir}netif:ppp: # -i {IncDir}netif:ppp:polarssl: Sym-68K = -sym off COptions = -includes unix {Includes} {Sym-68K} -mbg off -model near -opt space -w off #-includes unix #-model far LOptions = -mf -d -t 'APPL' -c 'LWIP' -model near AddDebugOpt = -d LWIP_DEBUG -u LWIP_NOASSERT NoDebugOpt = -u LWIP_DEBUG -d LWIP_NOASSERT ### Source Files ### SrcFiles = {MacSrc}test.c ¶ {MacSrc}sys_arch.c ¶ {MacSrc}sio.c ¶ # {AppsDir}tcpecho_raw:echo.c ¶ {AppsDir}httpserver_raw:httpd.c ¶ {AppsDir}httpserver_raw:fs.c ¶ {APISrc}err.c ¶ # {CoreSrc}init.c ¶ # {CoreSrc}mem.c ¶ {CoreSrc}memp.c ¶ {CoreSrc}netif.c ¶ {CoreSrc}inet_chksum.c ¶ {CoreSrc}pbuf.c ¶ {CoreSrc}raw.c ¶ # {CoreSrc}stats.c ¶ {CoreSrc}tcp_in.c ¶ {CoreSrc}tcp_out.c ¶ {CoreSrc}tcp.c ¶ # {CoreSrc}udp.c ¶ {CoreSrc}timers.c ¶ # {IPV4Src}icmp.c ¶ # {IPV4Src}igmp.c ¶ {IPV4Src}ip4.c ¶ {IPV4Src}ip4_addr.c ¶ # {IPV4Src}ip_frag.c ¶ # {NetISrc}etharp.c ¶ # {NetISrc}slipif.c ¶ {PPPISrc}ppp.c ¶ {PPPISrc}lcp.c ¶ {PPPISrc}magic.c ¶ {PPPISrc}auth.c ¶ # {PPPISrc}upap.c ¶ {PPPISrc}ipcp.c ¶ {PPPISrc}utils.c ¶ {PPPISrc}fsm.c # {PPPISrc}polarssl:md5.c ### Object Files ### ObjectFiles = "{MacSrc}sys_arch.c.l.o" ¶ "{MacSrc}sio.c.p.o" ¶ # "{AppsDir}echo.c.a.o" ¶ "{AppsDir}httpserver_raw:httpd.c.a.o" ¶ "{AppsDir}httpserver_raw:fs.c.a.o" ¶ "{SrcDir}err.c.l.o" ¶ # "{SrcDir}init.c.l.o" ¶ # "{SrcDir}mem.c.l.o" ¶ "{SrcDir}memp.c.l.o" ¶ "{SrcDir}netif.c.ud.o" ¶ "{SrcDir}inet_chksum.c.l.o" ¶ "{SrcDir}pbuf.c.l.o" ¶ "{SrcDir}raw.c.l.o" ¶ # "{SrcDir}stats.c.l.o" ¶ "{SrcDir}tcp_in.c.l.o" ¶ "{SrcDir}tcp_out.c.l.o" ¶ "{SrcDir}tcp.c.l.o" ¶ # "{SrcDir}udp.c.l.o" ¶ "{SrcDir}timers.c.l.o" ¶ # "{SrcDir}autoip.c.l.o" ¶ # "{SrcDir}icmp.c.l.o" ¶ # "{SrcDir}igmp.c.l.o" ¶ "{SrcDir}ip4.c.l.o" ¶ "{SrcDir}ip4_addr.c.l.o" ¶ # "{SrcDir}ip_frag.c.l.o" ¶ # "{NetISrc}etharp.c.l.o" ¶ # "{NetISrc}slipif.c.p.o" ¶ "{NetISrc}ppp.c.p.o" ¶ "{NetISrc}lcp.c.ud.o" ¶ "{NetISrc}magic.c.p.o" ¶ "{NetISrc}auth.c.ud.o" ¶ # "{NetISrc}upap.c.p.o" ¶ "{NetISrc}ipcp.c.ud.o" ¶ "{NetISrc}utils.c.p.o" ¶ "{NetISrc}fsm.c.ud.o" # "{NetISrc}md5.c.p.o" ### Libraries ### # Use the Libraries from MPW 3.1 CLibraries-Old = {CLibraries}::Libraries-3.1:CLibraries: Libraries-Old = {Libraries}::Libraries-3.1:Libraries: #CLibraries-Old = {CLibraries} #Libraries-Old = {Libraries LibFiles-Old = ¶ # "{CLibraries-Old}CSANELib.o" ¶ # "{CLibraries-Old}Math.o" ¶ # "{CLibraries-Old}Complex.o" ¶ "{CLibraries-Old}StdCLib.o" ¶ "{CLibraries-Old}CInterface.o" ¶ "{CLibraries-Old}CRuntime.o" ¶ # "{Libraries-Old}ToolLibs.o" ¶ # "{Libraries-Old}Runtime.o" ¶ "{Libraries-Old}Interface.o" LibFiles-68K = ¶ # "{Libraries}MathLib.o" ¶ "{CLibraries}StdCLib.o" ¶ "{Libraries}MacRuntime.o" ¶ "{Libraries}IntEnv.o" ¶ "{Libraries}Interface.o" # Special case because of the /r/n issues. "{AppsDir}httpserver_raw:httpd.c.a.o" Ä "{AppsDir}httpserver_raw:httpd.c" {C} {Deps} -o {Targ} {COptions} -noMapCR {NoDebugOpt} -seg LWAPP ### Default Rules ### .c.m.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.m.o {COptions} {NoDebugOpt} -seg Main .c.n.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.n.o {COptions} {NoDebugOpt} -seg Main -d TEST_MAIN_DISABLE .c.pp.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.pp.o {COptions} {NoDebugOpt} -seg LWPPPL .c.p.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.p.o {COptions} {NoDebugOpt} -seg LWPPP .c.ud.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.ud.o {COptions} {NoDebugOpt} -seg LWUPDN .c.a.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.a.o {COptions} {NoDebugOpt} -seg LWAPP .c.l.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.l.o {COptions} {NoDebugOpt} -seg LWTCPIP .c.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions} {NoDebugOpt} -seg Main {MacSrc} Ä {MacSrc} {NetISrc} Ä {NetISrc} {PPPISrc} {SrcDir} Ä {CoreSrc} {IPV4Src} {APISrc} ### Build Rules ### TestEcho ÄÄ "{MacSrc}test.c.m.o" {ObjectFiles} {LibFiles-Old} {¥MondoBuild¥} Link ¶ -o {Targ} ¶ "{MacSrc}test.c.m.o" ¶ {ObjectFiles} ¶ {LibFiles-Old} ¶ {Sym-68K} ¶ {LOptions} If "{Sym-68K}" =~ /-sym Å[nNuU]Å/ ILinkToSYM {Targ}.NJ -mf -sym 3.2 -c 'sade' End CObjs = "{MacSrc}test.c.n.o" ¶ "{MacSrc}ElWhip.c.n.o" ¶ {ObjectFiles} ElWhip ÄÄ {CObjs} {LibFiles-Old} {¥MondoBuild¥} Link ¶ -o {Targ} ¶ {CObjs} ¶ {LibFiles-Old} ¶ {Sym-68K} ¶ {LOptions} ElWhip ÄÄ ElWhip.r ElWhip.h {¥MondoBuild¥} Rez -rd -o {Targ} ElWhip.r -append DeRez "ElWhip_ICN.rsrc" | Rez -o {Targ} -append #ElWhip-distrib Ä ElWhip DiskImg = 'Mac OS X:Users:epooch:Documents:MacOS6.dmg' ElWhip-vMac Ä ElWhip {DiskImg} Open -f 'Mac OS X:Users:epooch:Documents:MacOS6.dmg' Alert "Click OK after the volume mounts to continue..." Loop If `Exists 'MacOS6:'` Break End End Duplicate ElWhip 'MacOS6:ElWhip-vMac'; Eject MacOS6 ### Optional Dependencies ### ### Build this target to generate "include file" dependencies. ### Dependencies Ä $OutOfDate MakeDepend ¶ -append {MAKEFILE} ¶ -ignore "{CIncludes}" ¶ -objdir "{ObjDir}" ¶ -objext .o ¶ {Includes} ¶ {SrcFiles} \ No newline at end of file +# File: Makefile # Target: TestEcho (MPW 3.1 libraries), ElWhip (MPW 3.1 libraries) # Created: Sunday, November 29, 2009 11:11:08 PM # # ElWhip uses MPW 3.5 and Link (rather than iLink) and the Libraries and Interfaces +# from MPW 3.1 to build a program to run on all System versions, +# even earlier than System 6.08. # Copy (or make an Alias of) the Interfaces:CIncludes and Libraries folders from +# MPW 3.1 and name them Interfaces:CIncludes-3.1 and Libraries-3.1 MAKEFILE = MakeFile ¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified ObjDir = : SrcDir = ::::lwip:src: IncDir = {SrcDir}include: APISrc = "{SrcDir}api:" CoreSrc = "{SrcDir}core:" IPV4Src = "{CoreSrc}ipv4:" NetISrc = "{SrcDir}netif:" PPPISrc = "{NetISrc}ppp:" ContribDir = ::: PortsDir = {ContribDir}ports: AppsDir = {ContribDir}apps: MacSrc = {PortsDir}mac: # Use the includes from MPW 3.1 Includes = ¶ -i "{CIncludes}:CIncludes-3.1:" ¶ -i {MacSrc}include: ¶ -i {MacSrc}include:arch: ¶ -i {AppsDir} ¶ -i {IncDir} ¶ -i {IncDir}lwip: ¶ -i {IncDir}ipv4: ¶ -i {IncDir}ipv6: ¶ -i {IncDir}netif: ¶ -i {AppsDir}httpserver_raw: ¶ -i {IncDir}netif:ppp: # -i {IncDir}netif:ppp:polarssl: Sym-68K = -sym off COptions = -includes unix {Includes} {Sym-68K} -mbg off -model near -opt space -w off #-includes unix #-model far LOptions = -mf -d -t 'APPL' -c 'LWIP' -model near AddDebugOpt = -d LWIP_DEBUG -u LWIP_NOASSERT NoDebugOpt = -u LWIP_DEBUG -d LWIP_NOASSERT ### Source Files ### SrcFiles = {MacSrc}test.c ¶ {MacSrc}sys_arch.c ¶ {MacSrc}sio.c ¶ # {AppsDir}tcpecho_raw:echo.c ¶ {AppsDir}httpserver_raw:httpd.c ¶ {AppsDir}httpserver_raw:fs.c ¶ {APISrc}err.c ¶ # {CoreSrc}init.c ¶ # {CoreSrc}mem.c ¶ {CoreSrc}memp.c ¶ {CoreSrc}netif.c ¶ {CoreSrc}inet_chksum.c ¶ {CoreSrc}pbuf.c ¶ {CoreSrc}raw.c ¶ # {CoreSrc}stats.c ¶ {CoreSrc}tcp_in.c ¶ {CoreSrc}tcp_out.c ¶ {CoreSrc}tcp.c ¶ # {CoreSrc}udp.c ¶ {CoreSrc}timers.c ¶ # {IPV4Src}icmp.c ¶ # {IPV4Src}igmp.c ¶ {IPV4Src}ip4.c ¶ {IPV4Src}ip4_addr.c ¶ # {IPV4Src}ip_frag.c ¶ # {NetISrc}etharp.c ¶ # {NetISrc}slipif.c ¶ {PPPISrc}ppp.c ¶ {PPPISrc}lcp.c ¶ {PPPISrc}magic.c ¶ {PPPISrc}auth.c ¶ # {PPPISrc}upap.c ¶ {PPPISrc}ipcp.c ¶ {PPPISrc}utils.c ¶ {PPPISrc}fsm.c # {PPPISrc}polarssl:md5.c ### Object Files ### ObjectFiles = "{MacSrc}sys_arch.c.l.o" ¶ "{MacSrc}sio.c.p.o" ¶ # "{AppsDir}echo.c.a.o" ¶ "{AppsDir}httpserver_raw:httpd.c.a.o" ¶ "{AppsDir}httpserver_raw:fs.c.a.o" ¶ "{SrcDir}err.c.l.o" ¶ # "{SrcDir}init.c.l.o" ¶ # "{SrcDir}mem.c.l.o" ¶ "{SrcDir}memp.c.l.o" ¶ "{SrcDir}netif.c.ud.o" ¶ "{SrcDir}inet_chksum.c.l.o" ¶ "{SrcDir}pbuf.c.l.o" ¶ "{SrcDir}raw.c.l.o" ¶ # "{SrcDir}stats.c.l.o" ¶ "{SrcDir}tcp_in.c.l.o" ¶ "{SrcDir}tcp_out.c.l.o" ¶ "{SrcDir}tcp.c.l.o" ¶ # "{SrcDir}udp.c.l.o" ¶ "{SrcDir}timers.c.l.o" ¶ # "{SrcDir}autoip.c.l.o" ¶ # "{SrcDir}icmp.c.l.o" ¶ # "{SrcDir}igmp.c.l.o" ¶ "{SrcDir}ip4.c.l.o" ¶ "{SrcDir}ip4_addr.c.l.o" ¶ # "{SrcDir}ip_frag.c.l.o" ¶ # "{NetISrc}etharp.c.l.o" ¶ # "{NetISrc}slipif.c.p.o" ¶ "{NetISrc}ppp.c.p.o" ¶ "{NetISrc}lcp.c.ud.o" ¶ "{NetISrc}magic.c.p.o" ¶ "{NetISrc}auth.c.ud.o" ¶ # "{NetISrc}upap.c.p.o" ¶ "{NetISrc}ipcp.c.ud.o" ¶ "{NetISrc}utils.c.p.o" ¶ "{NetISrc}fsm.c.ud.o" # "{NetISrc}md5.c.p.o" ### Libraries ### # Use the Libraries from MPW 3.1 CLibraries-Old = {CLibraries}::Libraries-3.1:CLibraries: Libraries-Old = {Libraries}::Libraries-3.1:Libraries: #CLibraries-Old = {CLibraries} #Libraries-Old = {Libraries LibFiles-Old = ¶ # "{CLibraries-Old}CSANELib.o" ¶ # "{CLibraries-Old}Math.o" ¶ # "{CLibraries-Old}Complex.o" ¶ "{CLibraries-Old}StdCLib.o" ¶ "{CLibraries-Old}CInterface.o" ¶ "{CLibraries-Old}CRuntime.o" ¶ # "{Libraries-Old}ToolLibs.o" ¶ # "{Libraries-Old}Runtime.o" ¶ "{Libraries-Old}Interface.o" LibFiles-68K = ¶ # "{Libraries}MathLib.o" ¶ "{CLibraries}StdCLib.o" ¶ "{Libraries}MacRuntime.o" ¶ "{Libraries}IntEnv.o" ¶ "{Libraries}Interface.o" # Special case because of the /r/n issues. "{AppsDir}httpserver_raw:httpd.c.a.o" Ä "{AppsDir}httpserver_raw:httpd.c" {C} {Deps} -o {Targ} {COptions} -noMapCR {NoDebugOpt} -seg LWAPP ### Default Rules ### .c.m.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.m.o {COptions} {NoDebugOpt} -seg Main .c.n.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.n.o {COptions} {NoDebugOpt} -seg Main -d TEST_MAIN_DISABLE .c.pp.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.pp.o {COptions} {NoDebugOpt} -seg LWPPPL .c.p.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.p.o {COptions} {NoDebugOpt} -seg LWPPP .c.ud.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.ud.o {COptions} {NoDebugOpt} -seg LWUPDN .c.a.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.a.o {COptions} {NoDebugOpt} -seg LWAPP .c.l.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.l.o {COptions} {NoDebugOpt} -seg LWTCPIP .c.o Ä .c {¥MondoBuild¥} {C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions} {NoDebugOpt} -seg Main {MacSrc} Ä {MacSrc} {NetISrc} Ä {NetISrc} {PPPISrc} {SrcDir} Ä {CoreSrc} {IPV4Src} {APISrc} ### Build Rules ### TestEcho ÄÄ "{MacSrc}test.c.m.o" {ObjectFiles} {LibFiles-Old} {¥MondoBuild¥} Link ¶ -o {Targ} ¶ "{MacSrc}test.c.m.o" ¶ {ObjectFiles} ¶ {LibFiles-Old} ¶ {Sym-68K} ¶ {LOptions} If "{Sym-68K}" =~ /-sym Å[nNuU]Å/ ILinkToSYM {Targ}.NJ -mf -sym 3.2 -c 'sade' End CObjs = "{MacSrc}test.c.n.o" ¶ "{MacSrc}ElWhip.c.n.o" ¶ {ObjectFiles} ElWhip ÄÄ {CObjs} {LibFiles-Old} {¥MondoBuild¥} Link ¶ -o {Targ} ¶ {CObjs} ¶ {LibFiles-Old} ¶ {Sym-68K} ¶ {LOptions} ElWhip ÄÄ ElWhip.r ElWhip.h {¥MondoBuild¥} Rez -rd -o {Targ} ElWhip.r -append DeRez "ElWhip_ICN.rsrc" | Rez -o {Targ} -append #ElWhip-distrib Ä ElWhip DiskImg = 'Mac OS X:Users:epooch:Documents:MacOS6.dmg' ElWhip-vMac Ä ElWhip {DiskImg} Open -f 'Mac OS X:Users:epooch:Documents:MacOS6.dmg' Alert "Click OK after the volume mounts to continue..." Loop If `Exists 'MacOS6:'` Break End End Duplicate ElWhip 'MacOS6:ElWhip-vMac'; Eject MacOS6 ### Optional Dependencies ### ### Build this target to generate "include file" dependencies. ### Dependencies Ä $OutOfDate MakeDepend ¶ -append {MAKEFILE} ¶ -ignore "{CIncludes}" ¶ -objdir "{ObjDir}" ¶ -objext .o ¶ {Includes} ¶ {SrcFiles} \ No newline at end of file