2014-12-15 22:35:18 +00:00
|
|
|
# The *_SRC variables are used to define segments; see the "%.o" recipe.
|
2014-11-06 04:26:33 +00:00
|
|
|
# shell/hush.c is divided into segments as specified within the file itself.
|
|
|
|
|
|
|
|
MAIN_SRC = shell/hush.c
|
|
|
|
|
|
|
|
SHELL_OTHER_SRC = \
|
2014-11-02 03:59:10 +00:00
|
|
|
shell/match.c \
|
|
|
|
shell/math.c \
|
|
|
|
shell/random.c \
|
2014-11-03 04:11:07 +00:00
|
|
|
shell/shell.common.c \
|
2014-11-19 02:51:04 +00:00
|
|
|
shell/glob.c \
|
|
|
|
shell/fnmatch.c
|
2014-11-06 04:26:33 +00:00
|
|
|
|
|
|
|
COREUTILS_SRC = \
|
2014-11-02 03:59:10 +00:00
|
|
|
coreutils/echo.c \
|
|
|
|
coreutils/test.c \
|
2014-11-06 04:26:33 +00:00
|
|
|
coreutils/test.ptr.hack.c
|
|
|
|
|
|
|
|
LIBBB_A_SRC = \
|
2014-11-06 19:08:38 +00:00
|
|
|
libbb/lineedit.c
|
2014-11-06 17:42:17 +00:00
|
|
|
|
|
|
|
LIBBB_B_SRC = \
|
2014-11-06 04:26:33 +00:00
|
|
|
libbb/appletlib.c \
|
|
|
|
libbb/getopt32.c \
|
|
|
|
libbb/error.retval.c \
|
2014-11-02 03:59:10 +00:00
|
|
|
libbb/endofname.c \
|
2014-11-03 04:11:07 +00:00
|
|
|
libbb/bb.strtonum.c \
|
|
|
|
libbb/full.write.c \
|
|
|
|
libbb/bb.qsort.c \
|
|
|
|
libbb/get.line.c \
|
|
|
|
libbb/conc.pathfile.c \
|
|
|
|
libbb/last.char.is.c \
|
|
|
|
libbb/cmp.str.array.c \
|
2014-11-02 03:59:10 +00:00
|
|
|
libbb/llist.c \
|
2014-11-06 04:26:33 +00:00
|
|
|
libbb/escape.seq.c \
|
2014-11-02 03:59:10 +00:00
|
|
|
libbb/messages.c \
|
2014-11-03 04:11:07 +00:00
|
|
|
libbb/bb.basename.c \
|
2014-11-22 22:53:59 +00:00
|
|
|
libbb/get.exec.path.c \
|
|
|
|
libbb/exec.gno.c
|
2014-11-06 04:26:33 +00:00
|
|
|
|
2014-11-06 17:42:17 +00:00
|
|
|
LIBBB_C_SRC = \
|
2014-11-06 04:26:33 +00:00
|
|
|
libbb/perror.msg.c \
|
|
|
|
libbb/signal.names.c \
|
|
|
|
libbb/safe.strncpy.c \
|
|
|
|
libbb/platform.c \
|
|
|
|
libbb/signals.c \
|
|
|
|
libbb/printable.str.c \
|
|
|
|
libbb/read.key.c \
|
|
|
|
libbb/safe.write.c \
|
|
|
|
libbb/read.c \
|
|
|
|
libbb/s.gethostname.c \
|
|
|
|
libbb/safe.poll.c \
|
|
|
|
libbb/parse.mode.c \
|
2014-11-22 05:05:38 +00:00
|
|
|
libbb/poll.c \
|
2014-12-03 16:46:57 +00:00
|
|
|
libbb/pgrp.c \
|
2015-10-17 06:08:06 +00:00
|
|
|
libbb/qsort.c \
|
|
|
|
libbb/auto.string.c
|
2014-11-06 17:42:17 +00:00
|
|
|
|
|
|
|
LIBBB_D_SRC = \
|
2014-11-06 04:26:33 +00:00
|
|
|
libbb/xfuncs.printf.c \
|
|
|
|
libbb/xfuncs.c \
|
|
|
|
libbb/xgetcwd.c \
|
|
|
|
libbb/xatonum.c \
|
|
|
|
libbb/xfunc.die.c \
|
|
|
|
libbb/skip.whitespc.c \
|
|
|
|
libbb/wfopen.c \
|
|
|
|
libbb/verror.msg.c \
|
|
|
|
libbb/time.c \
|
|
|
|
libbb/xrealloc.vec.c \
|
|
|
|
libbb/unicode.c \
|
2014-11-07 18:12:18 +00:00
|
|
|
libbb/vfork.and.run.c \
|
|
|
|
libbb/waitpid.emul.c
|
2014-12-27 17:33:31 +00:00
|
|
|
|
|
|
|
HEADERS = \
|
|
|
|
include/NUM.APPLETS.h \
|
|
|
|
include/appltmetadata.h \
|
|
|
|
include/autoconf.h \
|
|
|
|
include/busybox.h \
|
|
|
|
include/libbb.h \
|
|
|
|
include/platform.h \
|
|
|
|
include/poll.h \
|
|
|
|
include/unicode.h \
|
|
|
|
include/xatonum.h \
|
|
|
|
shell/glob.h \
|
|
|
|
shell/match.h \
|
|
|
|
shell/math.h \
|
|
|
|
shell/random.h \
|
|
|
|
shell/shell.common.h \
|
|
|
|
libbb/xatonum.tmplt.c
|
|
|
|
|
2014-11-06 17:42:17 +00:00
|
|
|
SRCS = $(MAIN_SRC) $(SHELL_OTHER_SRC) $(COREUTILS_SRC) $(LIBBB_A_SRC) \
|
|
|
|
$(LIBBB_B_SRC) $(LIBBB_C_SRC) $(LIBBB_D_SRC)
|
2014-12-15 22:35:18 +00:00
|
|
|
OBJS = $(SRCS:.c=.o)
|
2014-11-06 04:26:33 +00:00
|
|
|
ROOT = $(MAIN_SRC:.c=.root)
|
2014-11-02 03:59:10 +00:00
|
|
|
|
2014-11-06 17:42:17 +00:00
|
|
|
SHELL_OTHER_SEG = -SSHELLOTHER
|
|
|
|
COREUTILS_SEG = -SCOREUTILS_
|
|
|
|
LIBBB_A_SEG = -SLIBBB_A___
|
|
|
|
LIBBB_C_SEG = -SLIBBB_C___
|
|
|
|
# We need more separate segments in debug mode because the code is bigger.
|
|
|
|
.IF $(DEBUG)
|
|
|
|
LIBBB_B_SEG = -SLIBBB_B___
|
|
|
|
LIBBB_D_SEG = -SLIBBB_D___
|
|
|
|
.ELSE
|
|
|
|
LIBBB_B_SEG = -SLIBBB_A___
|
|
|
|
LIBBB_D_SEG = -SLIBBB_C___
|
|
|
|
.END
|
|
|
|
|
2014-11-02 03:59:10 +00:00
|
|
|
INCLUDES = -I include -I shell -I libbb
|
|
|
|
DEFINES = -Dhush_main=main -DNDEBUG
|
|
|
|
|
2014-11-19 02:51:04 +00:00
|
|
|
# This should be the ltermcap from GNO 2.0.4. The one from 2.0.6 is broken
|
|
|
|
# (links to unimplemented functions), so don't use it.
|
|
|
|
# The 2.0.4 version is in the "lib.shk" file within
|
|
|
|
# ftp://ftp.gno.org/pub/apple2/gs.specific/gno/base/v204/gnodisk1.sdk
|
2014-11-12 02:58:06 +00:00
|
|
|
LIBS = -l/usr/lib/libtermcap.204
|
|
|
|
|
2014-11-06 04:26:33 +00:00
|
|
|
# For correct handling of varargs methods and fork, we need
|
|
|
|
# optimize bit 3 set (no stack repair code).
|
|
|
|
# Optimize bit 6 breaks some standard-compliant varargs code,
|
|
|
|
# and bits 0, 4, and 5 have known bugs. Disable for now.
|
2014-12-27 16:07:53 +00:00
|
|
|
CFLAGS = -i -w -a1 -O14
|
2014-12-26 22:33:17 +00:00
|
|
|
STACKSIZE = 3072
|
2014-11-06 04:26:33 +00:00
|
|
|
|
2014-11-06 17:42:17 +00:00
|
|
|
.IF $(DEBUG)
|
|
|
|
CFLAGS += -g -DDEBUG
|
|
|
|
.END
|
2014-11-02 03:59:10 +00:00
|
|
|
|
|
|
|
PROG = hush
|
|
|
|
|
|
|
|
$(PROG): $(OBJS)
|
2014-11-12 02:58:06 +00:00
|
|
|
$(CC) $(LIBS) $(OBJS) -o $@
|
2014-11-02 03:59:10 +00:00
|
|
|
|
2014-12-27 17:33:31 +00:00
|
|
|
$(OBJS): $(HEADERS)
|
2014-12-15 22:35:18 +00:00
|
|
|
%.o: %.c
|
2014-11-06 04:26:33 +00:00
|
|
|
$(CC) $(INCLUDES) $(DEFINES) $(CFLAGS) -c $< -o $@ \
|
|
|
|
$(eq,$<,$(MAIN_SRC) -s$(STACKSIZE) -r) \
|
2014-11-06 17:42:17 +00:00
|
|
|
$(!eq,$(SHELL_OTHER_SRC:s/$<//),$(SHELL_OTHER_SRC) $(SHELL_OTHER_SEG)) \
|
|
|
|
$(!eq,$(COREUTILS_SRC:s/$<//),$(COREUTILS_SRC) $(COREUTILS_SEG)) \
|
|
|
|
$(!eq,$(LIBBB_A_SRC:s/$<//),$(LIBBB_A_SRC) $(LIBBB_A_SEG)) \
|
|
|
|
$(!eq,$(LIBBB_B_SRC:s/$<//),$(LIBBB_B_SRC) $(LIBBB_B_SEG)) \
|
|
|
|
$(!eq,$(LIBBB_C_SRC:s/$<//),$(LIBBB_C_SRC) $(LIBBB_C_SEG)) \
|
|
|
|
$(!eq,$(LIBBB_D_SRC:s/$<//),$(LIBBB_D_SRC) $(LIBBB_D_SEG))
|
2014-11-02 03:59:10 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2014-11-06 04:26:33 +00:00
|
|
|
$(RM) $(OBJS) $(ROOT) $(PROG)
|
2014-12-27 17:33:31 +00:00
|
|
|
|
|
|
|
.PHONY: chtyp
|
|
|
|
chtyp:
|
|
|
|
chtyp -l cc include/*.h coreutils/*.c libbb/*.c shell/*.c shell/*.h
|
2015-01-01 19:19:05 +00:00
|
|
|
chtyp -t txt LICENSE README* Makefile* notes/* etc/*
|
2014-12-27 17:33:31 +00:00
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
.SEQUENTIAL: build
|
|
|
|
build: chtyp $(PROG)
|
|
|
|
|
|
|
|
.PHONY: texttogs
|
|
|
|
texttogs:
|
|
|
|
udl -g include/*.h coreutils/*.c libbb/*.c shell/*.c shell/*.h \
|
|
|
|
LICENSE README* Makefile* notes/*
|