mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-01-21 05:08:35 +01:00
Move most generated files and binaries to 'out' dir
Better separation of sources and binaries Fewer files in 'src' dir
This commit is contained in:
parent
5cb5435119
commit
278246bde7
20
.gitignore
vendored
20
.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
.cproject
|
.cproject
|
||||||
.project
|
.project
|
||||||
/.idea/
|
/.idea/
|
||||||
|
/coverage/
|
||||||
|
|
||||||
# Jekyll generated (website) artifacts
|
# Jekyll generated (website) artifacts
|
||||||
/.jekyll-metadata
|
/.jekyll-metadata
|
||||||
@ -10,18 +11,21 @@
|
|||||||
/_support/
|
/_support/
|
||||||
|
|
||||||
# Build artifacts
|
# Build artifacts
|
||||||
*.o
|
|
||||||
*.a
|
|
||||||
/src/boxes
|
|
||||||
/src/boxes.exe
|
|
||||||
/src/boxes.h
|
|
||||||
/src/lex.yy.c
|
|
||||||
/src/parser.h
|
|
||||||
/src/parser.c
|
|
||||||
/doc/boxes.1
|
/doc/boxes.1
|
||||||
/doc/boxes.1.raw.html
|
/doc/boxes.1.raw.html
|
||||||
/doc/boxes.1.html
|
/doc/boxes.1.html
|
||||||
/pcre2-*/
|
/pcre2-*/
|
||||||
|
/out/
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
/src/boxes.h
|
||||||
|
|
||||||
|
# Legacy locations of generated files (no longer in use)
|
||||||
|
/src/boxes
|
||||||
|
/src/boxes.exe
|
||||||
|
/src/lex.yy.c
|
||||||
|
/src/parser.h
|
||||||
|
/src/parser.c
|
||||||
|
|
||||||
# Linux Packaging
|
# Linux Packaging
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
|
45
Makefile
45
Makefile
@ -23,14 +23,15 @@ GLOBALCONF = /usr/share/boxes
|
|||||||
GIT_STATUS = ($(shell git describe --dirty --always))
|
GIT_STATUS = ($(shell git describe --dirty --always))
|
||||||
BVERSION = 2.0.0
|
BVERSION = 2.0.0
|
||||||
|
|
||||||
ALL_FILES = LICENSE README.md README.Win32.md boxes-config
|
ALL_FILES = LICENSE README.md boxes-config
|
||||||
DOC_FILES = doc/boxes.1 doc/boxes.el
|
DOC_FILES = doc/boxes.1 doc/boxes.el
|
||||||
PKG_NAME = boxes-$(BVERSION)
|
PKG_NAME = boxes-$(BVERSION)
|
||||||
|
OUT_DIR = out
|
||||||
|
|
||||||
WIN_PCRE2_VERSION = 10.36
|
WIN_PCRE2_VERSION = 10.36
|
||||||
WIN_PCRE2_DIR = pcre2-$(WIN_PCRE2_VERSION)
|
WIN_PCRE2_DIR = pcre2-$(WIN_PCRE2_VERSION)
|
||||||
|
|
||||||
.PHONY: clean build win32 debug win32.debug infomsg replaceinfos test package win32.package package_common
|
.PHONY: clean build win32 debug win32.debug win32.pcre infomsg replaceinfos test package win32.package package_common
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ infomsg:
|
|||||||
|
|
||||||
replaceinfos: src/boxes.h doc/boxes.1
|
replaceinfos: src/boxes.h doc/boxes.1
|
||||||
|
|
||||||
src/boxes.h: src/boxes.h.in src/regulex.h src/shape.h Makefile
|
src/boxes.h: src/boxes.h.in Makefile
|
||||||
sed -e 's/--BVERSION--/$(BVERSION) $(GIT_STATUS)/; s/--GLOBALCONF--/$(subst /,\/,$(GLOBALCONF))/' src/boxes.h.in > src/boxes.h
|
sed -e 's/--BVERSION--/$(BVERSION) $(GIT_STATUS)/; s/--GLOBALCONF--/$(subst /,\/,$(GLOBALCONF))/' src/boxes.h.in > src/boxes.h
|
||||||
|
|
||||||
doc/boxes.1: doc/boxes.1.in Makefile
|
doc/boxes.1: doc/boxes.1.in Makefile
|
||||||
@ -69,23 +70,35 @@ doc/boxes.1.html: doc/boxes.1
|
|||||||
cat doc/boxes.1 | groff -mandoc -Thtml > doc/boxes.1.raw.html
|
cat doc/boxes.1 | groff -mandoc -Thtml > doc/boxes.1.raw.html
|
||||||
sed -E -e 's/<URL:([^&]+)>/<a href=\1>\1<\/a>/g' < doc/boxes.1.raw.html > doc/boxes.1.html
|
sed -E -e 's/<URL:([^&]+)>/<a href=\1>\1<\/a>/g' < doc/boxes.1.raw.html > doc/boxes.1.html
|
||||||
rm -f doc/boxes.1.raw.html
|
rm -f doc/boxes.1.raw.html
|
||||||
|
@echo "Conversion complete. Excessive manual work remains."
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
$(PKG_NAME).tar.gz:
|
$(OUT_DIR)/$(PKG_NAME).tar.gz:
|
||||||
mkdir -p $(PKG_NAME)/doc
|
mkdir -p $(OUT_DIR)/$(PKG_NAME)/doc
|
||||||
cp $(ALL_FILES) $(PKG_NAME)
|
cp $(ALL_FILES) $(OUT_DIR)/$(PKG_NAME)/
|
||||||
cp $(DOC_FILES) $(PKG_NAME)/doc
|
cp $(DOC_FILES) $(OUT_DIR)/$(PKG_NAME)/doc/
|
||||||
$(MAKE) -C src PKG_NAME=$(PKG_NAME) BOXES_PLATFORM=$(BOXES_PLATFORM) flags_$(BOXES_PLATFORM) package
|
$(MAKE) -C $(OUT_DIR) -f ../src/Makefile PKG_NAME=$(PKG_NAME) BOXES_PLATFORM=$(BOXES_PLATFORM) flags_$(BOXES_PLATFORM) package
|
||||||
if which gtar >/dev/null 2>&1 ; then gtar cfvz $(PKG_NAME).tar.gz $(PKG_NAME)/* ; \
|
if which gtar >/dev/null 2>&1 ; then cd $(OUT_DIR) ; gtar cfvz $(PKG_NAME).tar.gz $(PKG_NAME)/* ; \
|
||||||
else tar cfvz $(PKG_NAME).tar.gz $(PKG_NAME)/* ; fi
|
else cd $(OUT_DIR) ; tar cfvz $(PKG_NAME).tar.gz $(PKG_NAME)/* ; fi
|
||||||
rm -rf $(PKG_NAME)/
|
rm -rf $(OUT_DIR)/$(PKG_NAME)/
|
||||||
|
|
||||||
|
$(OUT_DIR)/zip/$(PKG_NAME).zip:
|
||||||
|
mkdir -p $(OUT_DIR)/zip/$(PKG_NAME)
|
||||||
|
unix2dos -n LICENSE $(OUT_DIR)/zip/$(PKG_NAME)/LICENSE.txt
|
||||||
|
unix2dos -n boxes-config $(OUT_DIR)/zip/$(PKG_NAME)/boxes.cfg
|
||||||
|
unix2dos -n README.md $(OUT_DIR)/zip/$(PKG_NAME)/README.md
|
||||||
|
unix2dos -n README.Win32.md $(OUT_DIR)/zip/$(PKG_NAME)/README.Win32.md
|
||||||
|
unix2dos -n doc/boxes.1 $(OUT_DIR)/zip/$(PKG_NAME)/boxes.1
|
||||||
|
unix2dos -n doc/boxes.1.html $(OUT_DIR)/zip/$(PKG_NAME)/boxes-man-1.html
|
||||||
|
cp -a $(OUT_DIR)/boxes.exe $(OUT_DIR)/zip/$(PKG_NAME)/
|
||||||
|
cd $(OUT_DIR)/zip ; zip $(PKG_NAME).zip $(PKG_NAME)/*
|
||||||
|
@echo Windows ZIP file created at $(OUT_DIR)/zip/$(PKG_NAME).zip
|
||||||
|
|
||||||
package: build
|
package: build
|
||||||
$(MAKE) BOXES_PLATFORM=unix $(PKG_NAME).tar.gz
|
$(MAKE) BOXES_PLATFORM=unix $(PKG_NAME).tar.gz
|
||||||
|
|
||||||
win32.package: win32
|
win32.package: win32 $(OUT_DIR)/zip/$(PKG_NAME).zip
|
||||||
$(MAKE) BOXES_PLATFORM=win32 $(PKG_NAME).tar.gz
|
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
@ -98,10 +111,10 @@ tools/LICENSE.txt: LICENSE
|
|||||||
tools/boxes.cfg: boxes-config
|
tools/boxes.cfg: boxes-config
|
||||||
unix2dos -n boxes-config tools/boxes.cfg
|
unix2dos -n boxes-config tools/boxes.cfg
|
||||||
|
|
||||||
tools/boxes.exe: src/boxes.exe
|
tools/boxes.exe: out/boxes.exe
|
||||||
cp src/boxes.exe tools/
|
cp out/boxes.exe tools/
|
||||||
|
|
||||||
src/boxes.exe: win32
|
out/boxes.exe: win32
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
83
src/Makefile
83
src/Makefile
@ -22,6 +22,10 @@ LEX = flex
|
|||||||
YACC = bison
|
YACC = bison
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
|
OUT_DIR = ../out
|
||||||
|
SRC_DIR = ../src
|
||||||
|
VPATH = $(SRC_DIR):$(SRC_DIR)/misc
|
||||||
|
|
||||||
GEN_HDR = parser.h boxes.h
|
GEN_HDR = parser.h boxes.h
|
||||||
GEN_SRC = parser.c lex.yy.c
|
GEN_SRC = parser.c lex.yy.c
|
||||||
GEN_FILES = $(GEN_SRC) $(GEN_HDR)
|
GEN_FILES = $(GEN_SRC) $(GEN_HDR)
|
||||||
@ -31,75 +35,78 @@ ORIG_GEN = lexer.l parser.y
|
|||||||
ORIG_NORM = boxes.c discovery.c generate.c regulex.c remove.c shape.c tools.c unicode.c
|
ORIG_NORM = boxes.c discovery.c generate.c regulex.c remove.c shape.c tools.c unicode.c
|
||||||
ORIG_SRC = $(ORIG_GEN) $(ORIG_NORM)
|
ORIG_SRC = $(ORIG_GEN) $(ORIG_NORM)
|
||||||
ORIG_FILES = $(ORIG_SRC) $(ORIG_HDR)
|
ORIG_FILES = $(ORIG_SRC) $(ORIG_HDR)
|
||||||
OTH_FILES = Makefile
|
|
||||||
|
|
||||||
ALL_FILES = $(ORIG_FILES) $(GEN_FILES) $(OTH_FILES)
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean build debug package flags_unix flags_win32 flags_
|
.PHONY: check_dir clean build debug package flags_unix flags_win32 flags_
|
||||||
|
|
||||||
|
check_dir:
|
||||||
|
@if [ "$(shell pwd | sed -e 's/^.*\///')" != "out" ] ; then \
|
||||||
|
echo ERROR: Please call make from the top level directory. ; \
|
||||||
|
exit 1 ; \
|
||||||
|
fi
|
||||||
|
|
||||||
build: flags_$(BOXES_PLATFORM)
|
$(OUT_DIR):
|
||||||
$(MAKE) BOXES_PLATFORM=$(BOXES_PLATFORM) ALL_OBJ="$(ALL_OBJ)" CFLAGS_ADDTL="-O $(CFLAGS_ADDTL)" STRIP=true flags_$(BOXES_PLATFORM) $(BOXES_EXECUTABLE_NAME)
|
mkdir $(OUT_DIR)
|
||||||
|
|
||||||
debug: flags_$(BOXES_PLATFORM)
|
build: flags_$(BOXES_PLATFORM) | $(OUT_DIR)
|
||||||
$(MAKE) BOXES_PLATFORM=$(BOXES_PLATFORM) ALL_OBJ="$(ALL_OBJ)" CFLAGS_ADDTL="-g $(CFLAGS_ADDTL)" STRIP=false flags_$(BOXES_PLATFORM) $(BOXES_EXECUTABLE_NAME)
|
$(MAKE) -C $(OUT_DIR) -f $(SRC_DIR)/Makefile BOXES_PLATFORM=$(BOXES_PLATFORM) ALL_OBJ="$(ALL_OBJ)" CFLAGS_ADDTL="-O $(CFLAGS_ADDTL)" STRIP=true flags_$(BOXES_PLATFORM) $(BOXES_EXECUTABLE_NAME)
|
||||||
|
|
||||||
boxes: $(ALL_OBJ)
|
debug: flags_$(BOXES_PLATFORM) | $(OUT_DIR)
|
||||||
$(CC) $(LDFLAGS) $(ALL_OBJ) -o $(BOXES_EXECUTABLE_NAME) -lunistring -lpcre2-32
|
$(MAKE) -C $(OUT_DIR) -f $(SRC_DIR)/Makefile BOXES_PLATFORM=$(BOXES_PLATFORM) ALL_OBJ="$(ALL_OBJ)" CFLAGS_ADDTL="-g $(CFLAGS_ADDTL)" STRIP=false flags_$(BOXES_PLATFORM) $(BOXES_EXECUTABLE_NAME)
|
||||||
if [ "$(STRIP)" = "true" ] ; then strip $(BOXES_EXECUTABLE_NAME) ; fi
|
|
||||||
|
|
||||||
boxes.exe: $(ALL_OBJ)
|
boxes: $(ALL_OBJ) | check_dir
|
||||||
$(CC) $(LDFLAGS) $(ALL_OBJ) -o $(BOXES_EXECUTABLE_NAME) -lkernel32 -l:libunistring.a -l:libpcre2-32.a -l:libiconv.a
|
$(CC) $(LDFLAGS) $^ -o $@ -lunistring -lpcre2-32
|
||||||
if [ "$(STRIP)" = "true" ] ; then strip $(BOXES_EXECUTABLE_NAME) ; fi
|
if [ "$(STRIP)" = "true" ] ; then strip $@ ; fi
|
||||||
|
|
||||||
|
boxes.exe: $(ALL_OBJ) | check_dir
|
||||||
|
$(CC) $(LDFLAGS) $^ -o $@ -lkernel32 -l:libunistring.a -l:libpcre2-32.a -l:libiconv.a
|
||||||
|
if [ "$(STRIP)" = "true" ] ; then strip $@ ; fi
|
||||||
|
|
||||||
|
|
||||||
flags_unix:
|
flags_unix:
|
||||||
$(eval CFLAGS := -I. -Wall -W $(CFLAGS_ADDTL))
|
$(eval CFLAGS := -I. -I$(SRC_DIR) -Wall -W $(CFLAGS_ADDTL))
|
||||||
$(eval LDFLAGS := $(LDFLAGS_ADDTL))
|
$(eval LDFLAGS := $(LDFLAGS_ADDTL))
|
||||||
$(eval BOXES_EXECUTABLE_NAME := boxes)
|
$(eval BOXES_EXECUTABLE_NAME := boxes)
|
||||||
$(eval ALL_OBJ := $(GEN_SRC:.c=.o) $(ORIG_NORM:.c=.o))
|
$(eval ALL_OBJ := $(GEN_SRC:.c=.o) $(ORIG_NORM:.c=.o))
|
||||||
|
|
||||||
flags_win32:
|
flags_win32:
|
||||||
$(eval CFLAGS := -Os -s -m32 -I. -Wall -W $(CFLAGS_ADDTL))
|
$(eval CFLAGS := -Os -s -m32 -I. -I$(SRC_DIR) -Wall -W $(CFLAGS_ADDTL))
|
||||||
$(eval LDFLAGS := -s -m32)
|
$(eval LDFLAGS := -s -m32)
|
||||||
$(eval BOXES_EXECUTABLE_NAME := boxes.exe)
|
$(eval BOXES_EXECUTABLE_NAME := boxes.exe)
|
||||||
$(eval ALL_OBJ := $(GEN_SRC:.c=.o) $(ORIG_NORM:.c=.o) misc/getopt.o)
|
$(eval ALL_OBJ := $(GEN_SRC:.c=.o) $(ORIG_NORM:.c=.o) getopt.o)
|
||||||
|
|
||||||
flags_:
|
flags_:
|
||||||
@echo Please call make from the top level directory.
|
@echo Please call make from the top level directory.
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
parser.c parser.h: parser.y boxes.h
|
parser.c parser.h: parser.y boxes.h | check_dir
|
||||||
$(YACC) -o parser.c -d parser.y
|
$(YACC) -o parser.c -d $<
|
||||||
|
|
||||||
lex.yy.c: lexer.l boxes.h
|
lex.yy.c: lexer.l boxes.h | check_dir
|
||||||
$(LEX) -t lexer.l > lexer.tmp.c
|
$(LEX) -t $< > lexer.tmp.c
|
||||||
echo '#include "config.h"' > lex.yy.c
|
echo '#include "config.h"' > lex.yy.c
|
||||||
cat lexer.tmp.c >> lex.yy.c
|
cat lexer.tmp.c >> lex.yy.c
|
||||||
rm lexer.tmp.c
|
rm lexer.tmp.c
|
||||||
|
|
||||||
boxes.o: boxes.c boxes.h discovery.h regulex.h shape.h tools.h unicode.h generate.h remove.h config.h
|
boxes.o: boxes.c boxes.h discovery.h regulex.h shape.h tools.h unicode.h generate.h remove.h config.h | check_dir
|
||||||
discovery.o: discovery.c discovery.h boxes.h tools.h config.h
|
discovery.o: discovery.c discovery.h boxes.h tools.h config.h | check_dir
|
||||||
tools.o: tools.c tools.h boxes.h shape.h unicode.h config.h
|
tools.o: tools.c tools.h boxes.h shape.h unicode.h config.h | check_dir
|
||||||
unicode.o: unicode.c unicode.h boxes.h tools.h config.h
|
unicode.o: unicode.c unicode.h boxes.h tools.h config.h | check_dir
|
||||||
shape.o: shape.c shape.h boxes.h tools.h config.h
|
shape.o: shape.c shape.h boxes.h tools.h config.h | check_dir
|
||||||
generate.o: generate.c generate.h boxes.h shape.h tools.h unicode.h config.h
|
generate.o: generate.c generate.h boxes.h shape.h tools.h unicode.h config.h | check_dir
|
||||||
remove.o: remove.c remove.h boxes.h shape.h tools.h unicode.h config.h
|
remove.o: remove.c remove.h boxes.h shape.h tools.h unicode.h config.h | check_dir
|
||||||
regulex.o: regulex.c regulex.h boxes.h tools.h unicode.h config.h
|
regulex.o: regulex.c regulex.h boxes.h tools.h unicode.h config.h | check_dir
|
||||||
lex.yy.o: lex.yy.c parser.h tools.h shape.h lexer.h config.h
|
getopt.o: misc/getopt.c misc/getopt.h | check_dir
|
||||||
parser.o: parser.c parser.h tools.h shape.h lexer.h config.h
|
parser.o: parser.c parser.h tools.h shape.h lexer.h config.h | check_dir
|
||||||
misc/getopt.o: misc/getopt.c
|
lex.yy.o: lex.yy.c parser.h tools.h shape.h lexer.h config.h | check_dir
|
||||||
|
|
||||||
|
|
||||||
package: $(BOXES_EXECUTABLE_NAME)
|
package: $(BOXES_EXECUTABLE_NAME)
|
||||||
if [ -z "$(PKG_NAME)" ] ; then exit 1 ; fi
|
if [ -z "$(PKG_NAME)" ] ; then exit 1 ; fi
|
||||||
cp $(BOXES_EXECUTABLE_NAME) ../$(PKG_NAME)
|
cp -a $(BOXES_EXECUTABLE_NAME) $(PKG_NAME)/
|
||||||
|
|
||||||
clean: flags_unix
|
clean:
|
||||||
rm -f $(ALL_OBJ) misc/getopt.o
|
rm -rf $(OUT_DIR)
|
||||||
rm -f $(GEN_FILES)
|
rm -f core $(GEN_HDR)
|
||||||
rm -f core boxes boxes.exe
|
|
||||||
|
|
||||||
|
|
||||||
#EOF
|
#EOF
|
||||||
|
@ -79,9 +79,9 @@ cat $testCaseFile | sed -n '/^:INPUT/,/^:OUTPUT-FILTER/p;' | sed '1d;$d' | tr -d
|
|||||||
cat $testCaseFile | sed -n '/^:OUTPUT-FILTER/,/^:EXPECTED\b.*$/p;' | sed '1d;$d' | tr -d '\r' > $testFilterFile
|
cat $testCaseFile | sed -n '/^:OUTPUT-FILTER/,/^:EXPECTED\b.*$/p;' | sed '1d;$d' | tr -d '\r' > $testFilterFile
|
||||||
cat $testCaseFile | sed -n '/^:EXPECTED/,/^:EOF/p;' | sed '1d;$d' | tr -d '\r' > $testExpectationFile
|
cat $testCaseFile | sed -n '/^:EXPECTED/,/^:EOF/p;' | sed '1d;$d' | tr -d '\r' > $testExpectationFile
|
||||||
|
|
||||||
declare boxesBinary=../src/boxes.exe
|
declare boxesBinary=../out/boxes.exe
|
||||||
if [ ! -x $boxesBinary ]; then
|
if [ ! -x $boxesBinary ]; then
|
||||||
boxesBinary=../src/boxes
|
boxesBinary=../out/boxes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$boxesEnv" ]; then
|
if [ ! -z "$boxesEnv" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user