1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 07:16:23 -05:00

Clean up Makefile to emphasize supported OS/Toolchain

This commit is contained in:
Renaud 2020-11-02 11:31:24 +08:00
parent 77aa2f156e
commit 2a47dcbbb4
2 changed files with 11 additions and 220 deletions

View File

@ -1,7 +1,7 @@
# Makefile for uEMACS, updated Tue, Aug 13, 2019 7:59:24 AM
# Makefile for uEMACS, updated 02 Nov 2020 09:40:01
SRC=basic.c bind.c bindable.c buffer.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c input.c isearch.c line.c lock.c main.c mingw32.c mlout.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c util.c window.c word.c wrapper.c wscreen.c
OBJ=basic.o bind.o bindable.o buffer.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o input.o isearch.o line.o lock.o main.o mingw32.o mlout.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o util.o window.o word.o wrapper.o wscreen.o
SRC=basic.c bind.c bindable.c buffer.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c input.c isearch.c line.c lock.c main.c mlout.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c util.c window.c word.c wrapper.c wscreen.c
OBJ=basic.o bind.o bindable.o buffer.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o input.o isearch.o line.o lock.o main.o mlout.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o util.o window.o word.o wrapper.o wscreen.o
HDR=basic.h bind.h bindable.h buffer.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isa.h isearch.h line.h lock.h mlout.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h util.h version.h window.h word.h wrapper.h wscreen.h
# DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them
@ -20,7 +20,7 @@ export E Q
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
# for windows based target, insure we strip the variant part
# CYGWIN_NT-6.1, CYGWIN_NT-6.1-WOW, CYGWIN_NT-6.1-WOW64, MINGW32_NT-6.1
# CYGWIN_NT-6.1, CYGWIN_NT-6.1-WOW, CYGWIN_NT-6.1-WOW64, MSYS_NT-10.0-19042
uname_S := $(shell sh -c 'echo $(uname_S) | sed s/_.*$$//')
PROGRAM=ue
@ -28,22 +28,16 @@ PROGRAM=ue
CC=gcc
WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
CFLAGS=-O2 $(WARNINGS)
#CC=c89 +O3 # HP
#CFLAGS= -D_HPUX_SOURCE -DSYSV
#CFLAGS=-O4 -DSVR4 # Sun
#CFLAGS=-O -qchars=signed # RS/6000
LIBS=-lcurses
DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM)
ifeq ($(uname_S),Linux)
DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM) -DPOSIX -DUSG
LIBS=-lcurses
DEFINES:= $(DEFINES) -DPOSIX -DUSG
else ifeq ($(uname_S),CYGWIN)
DEFINES=-DAUTOCONF -DCYGWIN -DSYSV -DPROGRAM=$(PROGRAM)
LIBS=-lcurses
DEFINES:= $(DEFINES) -DCYGWIN -DSYSV
else ifeq ($(uname_S),MSYS)
DEFINES=-DAUTOCONF -DCYGWIN -DSYSV -DPROGRAM=$(PROGRAM)
LIBS=-lcurses
DEFINES:= $(DEFINES) -DCYGWIN -DSYSV
else ifeq ($(uname_S),NetBSD)
DEFINES=-DAUTOCONF -DPOSIX -DBSD=1 -DPROGRAM=$(PROGRAM)
LIBS=-lcurses
DEFINES:= $(DEFINES) -DPOSIX -DBSD=1
else
$(error $(uname_S) needs configuration)
endif
@ -54,11 +48,6 @@ endif
#ifeq ($(uname_S),Darwin)
# DEFINES=-DAUTOCONF -DPOSIX -DSYSV -D_DARWIN_C_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600
#endif
#ifeq ($(uname_S),MINGW32)
## DEFINES=-DAUTOCONF -DSYSV -DMINGW32 -DPROGRAM=$(PROGRAM)
# DEFINES=-DAUTOCONF -DPOSIX -DSYSV -DPROGRAM=$(PROGRAM) -IC:/MinGW/include/ncursesw
# LIBS=
#endif
#DEFINES=-DAUTOCONF
#LIBS=-ltermcap # BSD
@ -139,7 +128,7 @@ depend: ${SRC}
$(Q) ${CC} ${CFLAGS} ${DEFINES} -c $*.c
# DO NOT DELETE THIS LINE -- make depend uses it
# Updated 30 Oct 2020 14:06:39
# Updated 02 Nov 2020 11:25:55
basic.o: basic.c basic.h retcode.h input.h bind.h mlout.h random.h \
terminal.h defines.h utf8.h window.h buffer.h line.h
@ -182,7 +171,6 @@ lock.o: lock.c estruct.h lock.h
main.o: main.c estruct.h basic.h retcode.h bind.h bindable.h buffer.h \
line.h utf8.h display.h eval.h execute.h file.h lock.h mlout.h random.h \
search.h terminal.h defines.h termio.h util.h version.h window.h
mingw32.o: mingw32.c
mlout.o: mlout.c mlout.h
names.o: names.c names.h basic.h retcode.h bind.h bindable.h buffer.h \
line.h utf8.h display.h estruct.h eval.h exec.h file.h isearch.h \

197
mingw32.c
View File

@ -1,197 +0,0 @@
/* mingw32.c -- */
#ifdef MINGW32
#include "termio.h"
#include "terminal.h"
#include <errno.h>
#include <io.h>
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
#include "utf8.h"
#include "wscreen.h"
static void vv( void) {}
static void vi( int i) {}
static int is( char *s) { return *s ; }
static void ttmove( int l, int c) ;
#define MARGIN 8
#define SCRSIZ 64
#define NPAUSE 10 /* # times thru update to pause. */
struct terminal term = {
24, /* These four values are set dynamically at open time. */
24,
80,
80,
MARGIN,
SCRSIZ,
NPAUSE,
ttopen,
#if PKCODE
ttclose,
#else
ttclose,
#endif
vv, /* ttkopen, */
vv, /* ttkclose, */
ttgetc,
ttputc,
ttflush,
ttmove,
vv, /* tteeol, */
vv, /* tteeop, */
vv, /* ttbeep, */
vi, /* ttrev, */
is /* ttcres */
#if COLOR
, iv, /* ttfcol, */
iv /* ttbcol */
#endif
#if SCROLLCODE
, NULL /* set dynamically at open time */
#endif
} ;
int ttrow ; /* Row location of HW cursor */
int ttcol ; /* Column location of HW cursor */
boolean eolexist = TRUE ; /* does clear to EOL exist? */
boolean revexist = FALSE ; /* does reverse video exist? */
boolean sgarbf = TRUE ; /* State of screen unknown */
char sres[ 16] ; /* Current screen resolution. */
/* NORMAL, CGA, EGA, VGA */
void ttopen( void) {
winit() ;
wcls() ;
term.t_mrow = term.t_nrow = wbottom() - wtop() ;
term.t_mcol = term.t_ncol = wright() - wleft() + 1 ;
wtitle( "uEMACS") ;
}
void ttclose( void) {
}
int ttputc( unicode_t c) {
char utf8[ 6] ;
int bytes ;
bytes = unicode_to_utf8( c, utf8) ;
fwrite( utf8, 1, bytes, stdout);
return 0 ;
}
void ttflush( void) {
int status ;
status = fflush( stdout);
while( status < 0 && errno == EAGAIN) {
_sleep( 1) ;
status = fflush( stdout) ;
}
if( status < 0)
exit( 15) ;
}
int ttgetc( void) {
static char buffer[ 32] ;
static int pending ;
unicode_t c ;
int count, bytes = 1, expected ;
count = pending ;
if( !count) {
count = read( 0, buffer, sizeof( buffer)) ;
if( count <= 0)
return 0 ;
pending = count ;
}
c = (unsigned char) buffer[ 0] ;
if( c >= 32 && c < 128)
goto done ;
/*
* Lazy. We don't bother calculating the exact
* expected length. We want at least two characters
* for the special character case (ESC+[) and for
* the normal short UTF8 sequence that starts with
* the 110xxxxx pattern.
*
* But if we have any of the other patterns, just
* try to get more characters. At worst, that will
* just result in a barely perceptible 0.1 second
* delay for some *very* unusual utf8 character
* input.
*/
expected = 2 ;
if( (c & 0xe0) == 0xe0)
expected = 6 ;
/* Special character - try to fill buffer */
if( count < expected) {
int n;
#if 0
ntermios.c_cc[VMIN] = 0;
ntermios.c_cc[VTIME] = 1; /* A .1 second lag */
tcsetattr(0, TCSANOW, &ntermios);
#endif
n = read(0, buffer + count, sizeof(buffer) - count);
/* Undo timeout */
#if 0
ntermios.c_cc[VMIN] = 1;
ntermios.c_cc[VTIME] = 0;
tcsetattr(0, TCSANOW, &ntermios);
#endif
if (n > 0)
pending += n;
}
if( pending > 1) {
unsigned char second = buffer[1];
/* Turn ESC+'[' into CSI */
if (c == 27 && second == '[') {
bytes = 2;
c = 128+27;
goto done;
}
}
bytes = utf8_to_unicode( buffer, 0, pending, &c) ;
done:
pending -= bytes ;
memmove( buffer, buffer+bytes, pending) ;
return c ;
}
int typahead( void) {
int x ; /* holds # of pending chars */
#ifdef FIONREAD
if( ioctl( 0, FIONREAD, &x) < 0)
#endif
x = 0 ;
return x ;
}
static void ttmove( int l, int c) {
wgoxy( c, l) ;
}
#else
typedef void _pedantic_empty_translation_unit ;
#endif
/* end of mingw32.c */