1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
all: minit msvc pidfilehack hard-reboot killall5 shutdown \
minit-update serdo
#CFLAGS=-pipe -march=i386 -fomit-frame-pointer -Os -I../dietlibc/include
CC=gcc
CFLAGS=-Wall -W -pipe -fomit-frame-pointer -Os
CROSS=
#CROSS=arm-linux-
LDFLAGS=-s
MANDIR=/usr/man
path = $(subst :, ,$(PATH))
diet_path = $(foreach dir,$(path),$(wildcard $(dir)/diet))
ifeq ($(strip $(diet_path)),)
ifneq ($(wildcard /opt/diet/bin/diet),)
DIET=/opt/diet/bin/diet
else
DIET=
endif
else
DIET:=$(strip $(diet_path))
endif
ifneq ($(DEBUG),)
CFLAGS+=-g
LDFLAGS+=-g
else
CFLAGS+=-O2 -fomit-frame-pointer
LDFLAGS+=-s
ifneq ($(DIET),)
DIET+=-Os
endif
endif
LDLIBS=-lowfat
libowfat_path = $(strip $(foreach dir,../libowfat*,$(wildcard $(dir)/textcode.h)))
ifneq ($(libowfat_path),)
CFLAGS+=$(foreach fnord,$(libowfat_path),-I$(dir $(fnord)))
LDFLAGS+=$(foreach fnord,$(libowfat_path),-L$(dir $(fnord)))
endif
minit: minit.o split.o openreadclose.o opendevconsole.o
msvc: msvc.o
minit-update: minit-update.o split.o openreadclose.o
serdo: serdo.o
shutdown: shutdown.o split.o openreadclose.o opendevconsole.o
$(DIET) $(CROSS)$(CC) $(LDFLAGS) -o shutdown $^
%.o: %.c
$(DIET) $(CROSS)$(CC) $(CFLAGS) -c $<
%: %.o
$(DIET) $(CROSS)$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
clean:
rm -f *.o minit msvc pidfilehack hard-reboot write_proc killall5 \
shutdown minit-update serdo
test: test.c
gcc -nostdlib -o $@ $^ -I../dietlibc/include ../dietlibc/start.o ../dietlibc/dietlibc.a
pidfilehack: pidfilehack.c
$(DIET) $(CROSS)$(CC) $(CFLAGS) -o $@ $^
hard-reboot: hard-reboot.c
$(DIET) $(CROSS)$(CC) $(CFLAGS) -o $@ $^
write_proc: write_proc.c
$(DIET) $(CROSS)$(CC) $(CFLAGS) -o $@ $^
killall5: killall5.c
$(DIET) $(CROSS)$(CC) $(CFLAGS) -o $@ $^
install-files:
install -d $(DESTDIR)/etc/minit $(DESTDIR)/sbin $(DESTDIR)/bin $(DESTDIR)$(MANDIR)/man8
install minit pidfilehack $(DESTDIR)/sbin
#install write_proc hard-reboot minit-update $(DESTDIR)/sbin
install hard-reboot minit-update $(DESTDIR)/sbin
install msvc serdo $(DESTDIR)/bin
install -m 4750 shutdown $(DESTDIR)/sbin
#test -f $(DESTDIR)/sbin/init || ln $(DESTDIR)/sbin/minit $(DESTDIR)/sbin/init
install -m 644 hard-reboot.8 minit-list.8 minit-shutdown.8 minit-update.8 minit.8 msvc.8 pidfilehack.8 serdo.8 $(DESTDIR)$(MANDIR)/man8
install-fifos:
-mkfifo -m 600 $(DESTDIR)/etc/minit/in $(DESTDIR)/etc/minit/out
install: install-files
VERSION=minit-$(shell head -n 1 CHANGES|sed 's/://')
CURNAME=$(notdir $(shell pwd))
tar: clean rename
cd ..; tar cvvf $(VERSION).tar.bz2 --use=bzip2 --exclude CVS $(VERSION)
rename:
if test $(CURNAME) != $(VERSION); then cd .. && mv $(CURNAME) $(VERSION); fi
|