summaryrefslogtreecommitdiffstats
path: root/util/mkelfImage/Makefile
blob: 2100ed4cbe0756f35c3f96b3aefd98b289953a9d (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
include Makefile.conf
VERSION:=2.7
RELEASE_DATE:=27 March 2006
PACKAGE:=mkelfImage

# You can specify DESTDIR on the command line to do a add
# a prefix to the install so it doesn't really happen
# Useful for building binary packages
DESTDIR =
CWD:=$(shell pwd)
OBJDIR:=objdir

pkgdatadir = $(datadir)/$(PACKAGE)
pkglibdir = $(libdir)/$(PACKAGE)
pkgincludedir = $(includedir)/$(PACKAGE)

CPPFLAGS=-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(RELEASE_DATE)"' -I include
HOST_CPPFLAGS=$(CPPFLAGS)
I386_CPPFLAGS=$(CPPFLAGS) -I arch/i386/include
IA64_CPPFLAGS=$(CPPFLAGS) -I arch/ia64/include

GENERATED_SRCS:=\
	./configure \
	./linux-i386/convert.bin.c\
	./linux-ia64/convert.bin.c

SPEC=$(OBJDIR)/mkelfImage-$(VERSION).spec
TARBALL=$(OBJDIR)/mkelfImage-$(VERSION).tar.gz
SRCS:=$(shell find ./AUTHORS ./COPYING ./Makefile ./Makefile.conf.in ./News \
	./configure.ac \
	./mkelfImage.spec.in \
	./config \
	./kunzip_src \
	./main ./util ./include ./arch \
	./linux-i386 \
	./linux-ia64 \
	! -path '*CVS*' ! -name '*~' ! -name '.*' -type f -print )
SRCS+=$(GENERATED_SRCS)
PSRCS:=$(patsubst ./%,mkelfImage-$(VERSION)/%,$(SRCS))
PSRCS+=./mkelfImage-$(VERSION).spec

SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage 
MAN8_TARGETS=$(OBJDIR)/man/man8/mkelfImage.8

TARGETS:=$(SBIN_TARGETS) $(MAN8_TARGETS)

DEPS:= Makefile Makefile.conf
all: $(TARGETS)

include main/Makefile
include util/Makefile
include linux-i386/Makefile
include linux-ia64/Makefile


clean::
	@$(RM) -rf objdir
	@$(RM) -rf rpm
	@$(RM) -f config.log config.status config.cache 
	@$(RM) -f $(SBIN_TARGETS) $(MAN1_TARGETS)
	@$(RM) -f mkelfImage-$(VERSION) $(TARBALL)

dist-clean:: clean
	@$(FIND) . -type f -name '*~' | xargs $(RM) -f
	@$(RM) Makefile.conf

maintainer-clean:: dist-clean
	@$(RM) -f $(SPEC) $(GENERATED_SRCS)


install: $(TARGETS)
	$(MKDIR) -p $(DESTDIR)/$(pkgdatadir)/elf32-i386/ $(DESTDIR)/$(sbindir) $(DESTDIR)/$(mandir)/man8
	$(CP) -ar $(SBIN_TARGETS) $(DESTDIR)/$(sbindir)/
	$(CP) -ar $(MAN8_TARGETS) $(DESTDIR)/$(mandir)/man8/


#%.1 : %.pl Makefile
#	mkdir -p $(@D)
#	pod2man --date="$(RELEASE_DATE)" --release="$(VERSION)" $*.pl > $@


tarball: $(TARBALL)


$(TARBALL): $(SRCS) $(SPEC)
	$(MKDIR) -p $(OBJDIR)
	$(RM) -f $(OBJDIR)/mkelfImage-$(VERSION)
	$(LN) -s .. $(OBJDIR)/mkelfImage-$(VERSION)
	(cd $(OBJDIR); $(TAR) -cf - $(PSRCS) | gzip -9) > $@

rpm: $(TARBALL)
	$(MKDIR) -p $(OBJDIR)/RPM $(OBJDIR)/SRPM $(OBJDIR)/BUILD $(OBJDIR)/SPECS $(OBJDIR)/TMP
	unset MAKEFLAGS MAKELEVEL; \
	$(RPM) -ta \
		--define '_rpmdir $(CWD)/$(OBJDIR)/RPM' \
		--define '_srcrpmdir $(CWD)/$(OBJDIR)/SRPM' \
		--define '_builddir $(CWD)/$(OBJDIR)/BUILD' \
		--define '_specdir $(CWD)/$(OBJDIR)/SPECS' \
		--define '_tmppath $(CWD)/$(OBJDIR)/TMP' \
		$(TARBALL)

Makefile.conf: Makefile.conf.in configure
	/bin/sh ./configure


configure: configure.ac
	autoconf
	$(RM) -rf autom4te.cache

$(SPEC): mkelfImage.spec.in Makefile
	$(SED) -e 's,^Version: $$,Version: $(VERSION),' $< > $@


.PHONY: echo install realinstall


echo:
	echo $(SRCS)
OpenPOWER on IntegriCloud