fix Makefile and README.md for 2019/duble

This commit is contained in:
Landon Curt Noll committed 2023-03-25 02:53:26 -07:00
1 parent fe10437f5c
commit a9e40a9182
3 files changed
+121 -39

No files matched your search

+5
View File
@@ -1,3 +1,8 @@
Darwin
Darwin.alt
FreeBSD
FreeBSD.alt
Linux
Linux.alt
prog
prog.alt
+88 -15
View File
@@ -65,14 +65,15 @@ X11_INCDIR= /opt/X11/include
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-dangling-else -Wno-format-security \
-Wno-implicit-int -Wno-incompatible-pointer-types \
-Wno-logical-op-parentheses -Wno-unused-value
-Wno-logical-op-parentheses -Wno-pedantic -Wno-return-type \
-Wno-unused-value
# Common C compiler warning flags
#
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
CWARN= -Wall -Wextra ${CSILENCE}
#CWARN= -Wall -Wextra -pedantic ${CSILENCE}
#CWARN= -Wall -Wextra ${CSILENCE}
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler standard
#
@@ -94,7 +95,7 @@ ARCH=
# Defines that are needed to compile
#
CDEFINE= -Dg=11 -Ds=0 -DV=24 -DW=80
CDEFINE=
#CDEFINE= -DIOCCC
# Include files that are needed to compile
@@ -103,8 +104,8 @@ CINCLUDE=
#CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h
#CINCLUDE= -I ${X11_INCDIR}
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
#CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11
#CINCLUDE= `${SDL2_CONFIG} --cflags`
# Optimization
#
@@ -128,7 +129,7 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
#LIBS= `${SDL2_CONFIG} --libs`
# C compiler to use
#
@@ -140,10 +141,7 @@ CC= cc
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-implicit-int-conversion -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-pedantic \
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
-Wno-strict-prototypes -Wno-zero-length-array
#CSILENCE+=
#
CWARN+= -Weverything
#
@@ -168,12 +166,18 @@ ENTRY= duble
PROG= prog
#
OBJ= ${PROG}.o
CSRC= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
LINES= 24
COLUMNS= 80
OS_SET= Linux FreeBSD Darwin
#################
# build the entry
@@ -186,17 +190,85 @@ all: data ${TARGET}
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${PROG}:
${MAKE} `${UNAME}`
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
check-os: check-os.sh
${SHELL} ./check-os.sh ${LINES} ${COLUMNS}
error-stty:
@echo "No stty command here. Please manually specify size in the Makefile." >&2 ; false
has-stty:
which stty >/dev/null || $(MAKE) error-stty
fullscreen: has-stty
${MAKE} ${PROG} \
LINES=`stty size | sed -s 's/ .*$$//'` \
COLUMNS=`stty size | sed -s 's/^.* //'`
Darwin: ${PROG}.c
${RM} -f $@
${CC} ${CFLAGS} -Dg=392 \
-Ds=46 \
-DV=${LINES} \
-DW=${COLUMNS} \
$< -o ${PROG} ${LIBS}
${LN} ${PROG} $@
FreeBSD: ${PROG}.c
${RM} -f $@
${CC} ${CFLAGS} -Dg=392 \
-Ds=46 \
-DV=${LINES} \
-DW=${COLUMNS} \
$< -o ${PROG} ${LIBS}
${LN} ${PROG} $@
Linux: ${PROG}.c
${RM} -f $@
${CC} ${CFLAGS} -Dg=11 \
-Ds=0 \
-DV=${LINES} \
-DW=${COLUMNS} \
$< -o ${PROG} ${LIBS}
${LN} ${PROG} $@
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
${PROG}.alt:
$(MAKE) `${UNAME}`.alt
Darwin.alt: ${PROG}.alt.c
${RM} -f $@
${CC} ${CFLAGS} -Dg=392 \
-Ds=46 \
-DV=${LINES} \
-DW=${COLUMNS} \
$< -o ${PROG}.alt ${LIBS}
${LN} ${PROG}.alt $@
FreeBSD.alt: ${PROG}.alt.c
${RM} -f $@
${CC} ${CFLAGS} -Dg=392 \
-Ds=46 \
-DV=${LINES} \
-DW=${COLUMNS} \
$< -o ${PROG}.alt ${LIBS}
${LN} ${PROG}.alt $@
Linux.alt: ${PROG}.alt.c
${RM} -f $@
${CC} ${CFLAGS} -Dg=11 \
-Ds=0 \
-DV=${LINES} \
-DW=${COLUMNS} \
$< -o ${PROG}.alt ${LIBS}
${LN} ${PROG}.alt $@
# data files
#
data: ${DATA}
@@ -220,6 +292,7 @@ clean:
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -f Darwin Darwin.alt FreeBSD FreeBSD.alt Linux Linux.alt
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
+28 -24
View File
@@ -1,32 +1,34 @@
# Best collaborative graphics
Etienne Duble
<https://lig-membres.imag.fr/duble>
Twitter: @etienne_duble
Etienne Duble
<https://lig-membres.imag.fr/duble>
Twitter: @etienne_duble
## To build:
# To build:
make all
```sh
make
```
### To run
### To run:
./prog file
```sh
./prog file
```
### Try:
./prog /tmp/drawing
```sh
./prog /tmp/drawing
```
(open another window / terminal)
Open another window / terminal.
./prog /tmp/drawing
(open more terminals....)
./prog /tmp/drawing
NOTE: this entry does not work under at least some versions of macOS.
```sh
./prog /tmp/drawing
```
Open more terminals...
### Alternate code
@@ -35,17 +37,19 @@ code might not work as well on macOS.
To compile this alternate version:
make alt
```sh
make alt
```
Use `prog.alt` as you would `prog` above.
### Selected Judges' Remarks:
## Judges' comments:
After starting the program, use the cursor keys, then try some modes, like "p"
or "l" (they toggle).
## Author's comments:
### Introduction
This program is a **graphics editor**, running on the terminal.
@@ -139,7 +143,9 @@ Note: the drawing files `prog` generates are probably even more portable than
The default size is the one of my xterm (see top of Makefile).
You may set it to the full size of your terminal window by typing:
$ make fullscreen
```sh
make fullscreen
```
IMPORTANT NOTES:
@@ -172,12 +178,10 @@ and it works on macOS too!
I must confess it was challenging to remain below the size limit with this little
change.
## Copyright:
--------------------------------------------------------------------------------
<!--
(c) Copyright 1984-2019, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
[judges]: http://www.ioccc.org/judges.html
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
-->