# -DDEBUG enables debugging facilities:
# you can increment debug level with debug keyword in
# config file, -d option, or by sending SIGUSR1 to init.
# SIGUSR2 sets debug level to 0.
# -DUNTRUSTED debugging code: on SIGINT it execs /sbin/init.ori
# (do this only in singleuser mode !)
# -DCONFIGURE on startup (and when requested), read /etc/init.conf
# and set parameters in it.
# -DFAKE_SYSLOG do not use syslog, but write to /dev/console.
# This makes it MUCH smaller !
# -DSMALL do not use perror, but write error codes.
# Makes it even smaller, but requires -DFAKE_SYSLOG.
# For the floppy version, compile this with -DFAKE_SYSLOG -DSMALL. If compiled
# with gcc1, it is not bigger than the original init (20k).
DEFINES = -DSMALL -DFAKE_SYSLOG
#DEFINES = -DDEBUG -DCONFIGURE
#DEFINES = -DDEBUG -DUNTRUSTED -DCONFIGURE
CFLAGS = -g -O -Wall -pipe
SRCS = init.c ttytab.c configure.c cf_table.c utils.c fake_syslog.c
OBJS = init.o ttytab.o configure.o cf_table.o utils.o fake_syslog.o
INC = init.h prototypes.h
#CC = /usr/local/gcc-2.3.3/bin/gcc
@[ -f .test ] && exec make test || \
exec make init CC="$(CC)" DEFINES="$(DEFINES)" OBJS="$(OBJS)"
exec make init CC="$(CC)" DEFINES="$(DEFINES) -DTESTRUN"
$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $(OBJS) $(LIBS)
nroff -mandoc init.8 > init.0
-rm -f $(OBJS) init init.0 .test .depend tags
[ -f $(BIN)$(ORI) ] || mv -f $(BIN) $(BIN)$(ORI)
-mv -f $(BIN) $(BIN)$(BAK)
install -c -s -o bin -g bin -m 0555 -s init $(BIN)
install -c -o bin -g bin -m 0444 init.0 $(MAN)
[ -f /etc/init.conf ] || install -c -o bin -g wheel -m 644 init.conf /etc
$(MKDEP) $(DEFINES) $(SRCS)
$(CC) -c $(CFLAGS) $(DEFINES) $<