summaryrefslogtreecommitdiffstats
path: root/loader2/Makefile
blob: 1af95a3dae092f3ebece8dc60871ddf1f5a7564c (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
include ../Makefile.inc

# JKFIXME: this should go somewhere common.  I need to know about diet in
# a few locations.  and we should really just always use diet
ifeq (i386, $(ARCH))
USEDIET=1
endif
# should we use diet on this arch?
ifeq (ppc, $(ARCH))
USEDIET=1
endif

# JKFIXME: switch to use system libslang and libnewt with msw's wcwidth()
SLANGLIB = ../minislang/libslang.a
NEWTLIB = ../mininewt/libnewt.a
ISYSLIB = ../isys/libisys.a
GUNZIP = -lz
MODULELINKAGE :=-lmodutils -lmodutilutil -lmodutilobj

BINS = init

HWOBJS = pcmcia.o usb.o firewire.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 \
	$(HWOBJS) $(METHOBJS)
LOADEROBJS = loader.o loader-pcmcia.o
NETOBJS = net.o urls.o telnet.o telnetd.o
NETOBJS = net.o urls.o ftp.o
PCMCIAOBJS = pcmcia.o $(NETOBJS)
SOURCES = $(subst .o,.c,$(OBJS)) loader.c

HWLIBS = -lkudzu_loader  -lpci

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


ifeq (1, $(USEDIET))
CFLAGS += -DGZLIB=1
DIET=diet
REALCC=gcc
CC=$(DIET) $(REALCC)
# JKFIXME: this also goes away when we go to system {newt,slang}
SLANGLIB = ../minislang/libslang-diet.a
NEWTLIB = ../mininewt/libnewt-diet.a
ISYSLIB = ../isys/libisys-diet.a
GUNZIP = ../isys/gzlib/libgunzip-diet.a
endif

ifeq (i386, $(ARCH))
BINS += loader
OBJS += dietstubs.o ctype.o
COPTS += -DUSE_LOGDEV
ISYSLIB += -lrpc
endif

all: $(BINS)

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 $(NEWTLIB) $(SLANGLIB)  $(KONOBJS)

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

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