| 1 | # What you can define: |
| 2 | # -DDEBUG enables debugging facilities: |
| 3 | # you can increment debug level with debug keyword in |
| 4 | # config file, -d option, or by sending SIGUSR1 to init. |
| 5 | # SIGUSR2 sets debug level to 0. |
| 6 | # -DUNTRUSTED debugging code: on SIGINT it execs /sbin/init.ori |
| 7 | # (do this only in singleuser mode !) |
| 8 | # -DCONFIGURE on startup (and when requested), read /etc/init.conf |
| 9 | # and set parameters in it. |
| 10 | # -DFAKE_SYSLOG do not use syslog, but write to /dev/console. |
| 11 | # This makes it MUCH smaller ! |
| 12 | # -DSMALL do not use perror, but write error codes. |
| 13 | # Makes it even smaller, but requires -DFAKE_SYSLOG. |
| 14 | # For the floppy version, compile this with -DFAKE_SYSLOG -DSMALL. If compiled |
| 15 | # with gcc1, it is not bigger than the original init (20k). |
| 16 | # |
| 17 | DEFINES = -DSMALL -DFAKE_SYSLOG |
| 18 | #DEFINES = -DDEBUG -DCONFIGURE |
| 19 | #DEFINES = -DDEBUG -DUNTRUSTED -DCONFIGURE |
| 20 | LDFLAGS = |
| 21 | CFLAGS = -g -O -Wall -pipe |
| 22 | LIBS = -lutil |
| 23 | SRCS = init.c ttytab.c configure.c cf_table.c utils.c fake_syslog.c |
| 24 | OBJS = init.o ttytab.o configure.o cf_table.o utils.o fake_syslog.o |
| 25 | INC = init.h prototypes.h |
| 26 | BIN = /sbin/init |
| 27 | BAK = .old |
| 28 | MAN = init.8 |
| 29 | #CC = /usr/local/gcc-2.3.3/bin/gcc |
| 30 | MKDEP = mkdep |
| 31 | TAGS = ctags |
| 32 | |
| 33 | |
| 34 | all! |
| 35 | @[ -f .test ] && exec make test || \ |
| 36 | exec make init CC="$(CC)" DEFINES="$(DEFINES)" OBJS="$(OBJS)" |
| 37 | |
| 38 | |
| 39 | test! .test |
| 40 | exec make init CC="$(CC)" DEFINES="$(DEFINES) -DTESTRUN" |
| 41 | |
| 42 | init: $(OBJS) |
| 43 | $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $(OBJS) $(LIBS) |
| 44 | |
| 45 | init.0: init.8 |
| 46 | nroff -mandoc init.8 > init.0 |
| 47 | |
| 48 | clean! |
| 49 | -rm -f $(OBJS) init init.0 .test .depend tags |
| 50 | |
| 51 | install! init init.0 |
| 52 | [ -f $(BIN)$(ORI) ] || mv -f $(BIN) $(BIN)$(ORI) |
| 53 | -mv -f $(BIN) $(BIN)$(BAK) |
| 54 | install -c -s -o bin -g bin -m 0555 -s init $(BIN) |
| 55 | install -c -o bin -g bin -m 0444 init.0 $(MAN) |
| 56 | [ -f /etc/init.conf ] || install -c -o bin -g wheel -m 644 init.conf /etc |
| 57 | |
| 58 | depend! |
| 59 | $(MKDEP) $(DEFINES) $(SRCS) |
| 60 | |
| 61 | tags! |
| 62 | $(TAGS) $(SRCS) |
| 63 | |
| 64 | .test: |
| 65 | make clean |
| 66 | touch .test |
| 67 | |
| 68 | .c.o: |
| 69 | $(CC) -c $(CFLAGS) $(DEFINES) $< |
| 70 | |