summaryrefslogtreecommitdiff
path: root/release/tool-Makefile
blob: 6a23b95ad2e8a0382d8c0bb4725d528f8fdb7ed1 (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
# Makefile for hurd image frobnication.

export OBJCOPY=objcopy

# Where we get programs from
image-dir=/
# Where we get libc 
libc-obj-dir = /gd4/hurd-native/build/glibc

smallso-LDFLAGS = -Wl,-rpath-link=/lib

BF=bfloppy
RF=rfloppy

bfloppy-files = $(bfloppy-bootfs:%=hurd/%) $(bfloppy-bootprogs:%=boot/%.gz) \
	       lib/ld.so boot/servers.boot
bfloppy-bootfs = ufs
bfloppy-bootprogs = gnumach serverboot

$(BF)/boot/servers.boot: bfloppy.boot
	@-rm -f $@
	@test -d $(@D) || mkdir -p $(@D)
	cp $< $@

$(BF)/%/: $(image-dir)/%/
	test -d $@ || mkdir -p $@
$(addsuffix .gz, $(addprefix $(BF)/boot/, $(bfloppy-bootprogs))): \
  $(BF)/boot/%.gz: $(image-dir)/boot/%
	@-rm -f $@
	@test -d $(@D) || mkdir -p $(@D)
	$(OBJCOPY) --strip-unneeded $< | gzip -9 > $@
$(BF)/%: $(image-dir)/%
	@-rm -f $@
	@test -d $(@D) || mkdir -p $(@D)
	$(OBJCOPY) --strip-unneeded $< $@

$(BF): $(bfloppy-files:%=$(BF)/%)
$(BF).tar: $(bfloppy-files:%=$(BF)/%)
	rm -f $@
	cd $(BF); tar covf ../$@ $(^:$(BF)/%=%)

rfloppy-files = $(rfloppy-hurd:%=hurd/%) $(rfloppy-progs:%=bin/%) \
		$(rfloppy-sprogs:%=sbin/%) \
	        $(rfloppy-solib:%=lib/%.so) hurd/exec \
	        lib/libc.so lib/libhurduser.so lib/libmachuser.so \
		servers/exec servers/socket/1 \
	        README tmp/ mnt/ dev/MAKEDEV
rfloppy-hurd = auth storeio null init proc term pfinet nfs ufs ext2fs
rfloppy-progs = bash ls cat settrans
rfloppy-sprogs = mkfs.ufs mkfs.ext2
rfloppy-solib = libtrivfs libthreads libshouldbeinlibc libports	\
	       libpager libiohelp libstore libihash libfshelp libnetfs ld

libc-satisfies = $(rfloppy-hurd:%=hurd/%) $(rfloppy-progs:%=bin/%) $(rfloppy-sprogs:%=sbin/%) $(rfloppy-solib:%=lib/%.so)

$(RF)/lib/libc.so: $(image-dir)/lib/libc.so $(image-dir)/lib/libhurduser.so $(image-dir)/lib/libmachuser.so $(libc-satisfies:%=$(image-dir)/%)
	mksmallso $(smallso-LDFLAGS) \
	  $@ $(libc-obj-dir)/libc_pic.a '-L$(image-dir)/lib -lhurduser -lmachuser' \
	  $(filter-out $(firstword $^),$^)

$(RF)/lib/libhurduser.so: $(RF)/lib/libc.so $(libc-satisfies:%=$(image-dir)/%)
	mksmallso $(smallso-LDFLAGS) $@ $(libc-obj-dir)/hurd/libhurduser_pic.a -L$(image-dir)/lib -lmachuser $(filter-out $(firstword $^),$^)

$(RF)/lib/libmachuser.so: $(RF)/lib/libc.so $(RF)/lib/libhurduser.so $(libc-satisfies:%=$(image-dir)/%)
	mksmallso $(smallso-LDFLAGS) $@ $(libc-obj-dir)/mach/libmachuser_pic.a '' $(filter-out $(firstword $^),$^)

$(RF)/bin/%: $(image-dir)/bin/%
	@-rm -f $@
	@test -d $(@D) || mkdir -p $(@D)
	$(OBJCOPY) --strip-unneeded $< $@
$(RF)/sbin/%: $(image-dir)/sbin/%
	@-rm -f $@
	@test -d $(@D) || mkdir -p $(@D)
	$(OBJCOPY) --strip-unneeded $< $@
$(RF)/hurd/%: $(image-dir)/hurd/%
	@-rm -f $@
	@test -d $(@D) || mkdir -p $(@D)
	$(OBJCOPY) --strip-unneeded $< $@
$(RF)/servers/%:
	@test -d $(@D) || mkdir -p $(@D)
	touch $@
$(RF)/%/: $(image-dir)/%/
	test -d $@ || mkdir -p $@

$(RF): $(rfloppy-files:%=$(RF)/%)
$(RF).tar: $(rfloppy-files:%=$(RF)/%)
	rm -f $@
	cd $(RF); tar covf ../$@ $(^:$(RF)/%=%)

bfloppy.%: $(bfloppy-files:%=$(BF)/%)
	mkfsimage -q $@ $(BF)
rfloppy.%.gz: $(rfloppy-files:%=$(RF)/%)
	mkfsimage --compress -q $@ $(RF)