summaryrefslogtreecommitdiffstats
path: root/loader2/Makefile
blob: c804938fc133d547804ad1b6f9d25f9d2e5f7f3a (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
include ../Makefile.inc

ifeq (.depend,$(wildcard .depend))
TARGET=$(PROGS)
else
TARGET=depend $(PROGS)
endif

SLANGLIB = -lslang
NEWTLIB = -lnewt
BTERMLIB = -lbterm -lbogl 
WLITELIB = -lwlite
ISYSLIB = ../isys/libisys.a
GUNZIP = -lz
MODULELINKAGE :=-lmodutils -lmodutilutil -lmodutilobj

BINS = init loader

HWOBJS = pcmcia.o usb.o firewire.o hardware.o
METHOBJS = method.o cdinstall.o hdinstall.o nfsinstall.o urlinstall.o
OBJS = log.o moduleinfo.o loadermisc.o modules.o moduledeps.o windows.o \
	lang.o kbd.o modules.o modstubs.o driverdisk.o \
	md5.o mediacheck.o kickstart.o driverselect.o \
	$(HWOBJS) $(METHOBJS)
LOADEROBJS = loader.o loader-pcmcia.o
NETOBJS = net.o urls.o ftp.o telnet.o telnetd.o
PCMCIAOBJS = pcmcia.o $(NETOBJS)
SOURCES = $(subst .o,.c,$(OBJS)) loader.c

HWLIBS = -lkudzu_loader  -lpci

DEBUG = -ggdb
COPTS = $(DEBUG) -Os -Wall -DVERSION='"$(VERSION)"'
CFLAGS = $(COPTS) -ffunction-sections -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBIO_H 
STATIC = -static

ifeq (1, $(USEDIET))
CFLAGS += -DGZLIB=1
DIET=diet
REALCC=gcc
CC=$(DIET) $(REALCC)
BTERMLIB = -lbtermdiet -lbogldiet 
WLITELIB = -lwlite
ISYSLIB = ../isys/libisys-diet.a
GUNZIP = ../isys/gzlib/libgunzip-diet.a

OBJS += dietstubs.o ctype.o
ISYSLIB += -lrpc
CTYPEDEP = ctype.c
else
OBJS += wcstubs.o
endif

ifeq (i386, $(ARCH))
COPTS += -DUSE_LOGDEV
endif

# translation stuff
LANGS = $(shell awk '{ print $$2 }' ../lang-table | egrep -v '(^en$$)')

TR = $(patsubst %,tr/%.tr,$(LANGS))
TRFILES = $(patsubst %,%.tr,$(LANGS))

all: $(BINS) loader.tr font.bgf.gz

font.bgf.gz: /usr/lib/bogl/font.bdf.gz /usr/bin/reduce-font unicode-linedraw-chars.txt
	zcat /usr/lib/bogl/font.bdf.gz > font.bdf
	export LANG=en_US.UTF-8; (cat unicode-linedraw-chars.txt; for I in ../po/*.po; do msgconv -t utf-8 $$I; done) | reduce-font font.bdf > font-reduced.bdf
	bdftobogl -b font-reduced.bdf > font.bgf
	rm -f font.bdf font-reduced.bdf
	gzip -9 -f font.bgf

loader.tr: $(TR) ../lang-table
	(cd tr; ls $(TRFILES) | cpio --quiet -Hcrc -o |gzip -9) > $@

tr/%.tr: ../po/%.po loader.po
	msgmerge $< loader.po | msgconv -t utf-8 | ./simplemot > $@

loader.po: $(wildcard *.c)
	xgettext --default-domain=loader --add-comments \
		--keyword=_ --keyword=N_ *.c

init: init.o
	$(CC) $(STATIC) $(COPTS) $(LDFLAGS) -o $@ init.o

init.o: init.c
	$(CC) $(COPTS) -c -o init.o init.c

mkctype: mkctype.c
	$(REALCC) $(COPTS) -o mkctype mkctype.c

ctype.c: mkctype
	./mkctype > ctype.c

loader.o: loader.c
	$(CC) -DINCLUDE_LOCAL -DINCLUDE_NETWORK $(CFLAGS) -o $@ -c $<

loader-local.o: loader.c
	$(CC) -DINCLUDE_LOCAL $(CFLAGS) -o $@ -c $<

loader-net.o: loader.c
	$(CC) -DINCLUDE_NETWORK $(CFLAGS) -o $@ -c $<

loader: loader.o $(OBJS) $(NETOBJS)
	$(CC) -g $(STATIC) -o $@ $^ -lpopt     \
	$(HWLIBS) $(ISYSLIB) \
	$(MODULELINKAGE) $(GUNZIP) \
	-lpump -lresolv $(NEWTLIB) $(SLANGLIB) $(BTERMLIB) $(WLITELIB)

clean:
	rm -f *.o *~ .depend init ctype.c mkctype \
	loader

depend: $(CTYPEDEP)
	$(CPP) $(CFLAGS) -DHAVE_CONFIG_H -M $(SOURCES) > .depend

install: all
	mkdir -p $(DESTDIR)/$(RUNTIMEDIR)/loader
	for n in $(BINS); do \
	    install -m 755 $$n $(DESTDIR)/$(RUNTIMEDIR)/loader; \
	    strip $(DESTDIR)/$(RUNTIMEDIR)/loader/$$n; \
	done
	install -m 644 loader.tr $(DESTDIR)/$(RUNTIMEDIR)/loader
	install -m 644 module-info $(DESTDIR)/$(RUNTIMEDIR)/loader
	install -m 644 font.bgf.gz $(DESTDIR)/$(RUNTIMEDIR)/loader

ifeq (.depend,$(wildcard .depend))
include .depend
endif