blob: 2100ed4cbe0756f35c3f96b3aefd98b289953a9d [file] [log] [blame]
Stefan Reinauerb34eea32008-02-15 18:16:06 +00001include Makefile.conf
2VERSION:=2.7
3RELEASE_DATE:=27 March 2006
4PACKAGE:=mkelfImage
5
6# You can specify DESTDIR on the command line to do a add
7# a prefix to the install so it doesn't really happen
8# Useful for building binary packages
9DESTDIR =
10CWD:=$(shell pwd)
11OBJDIR:=objdir
12
13pkgdatadir = $(datadir)/$(PACKAGE)
14pkglibdir = $(libdir)/$(PACKAGE)
15pkgincludedir = $(includedir)/$(PACKAGE)
16
17CPPFLAGS=-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(RELEASE_DATE)"' -I include
18HOST_CPPFLAGS=$(CPPFLAGS)
19I386_CPPFLAGS=$(CPPFLAGS) -I arch/i386/include
20IA64_CPPFLAGS=$(CPPFLAGS) -I arch/ia64/include
21
22GENERATED_SRCS:=\
23 ./configure \
24 ./linux-i386/convert.bin.c\
25 ./linux-ia64/convert.bin.c
26
27SPEC=$(OBJDIR)/mkelfImage-$(VERSION).spec
28TARBALL=$(OBJDIR)/mkelfImage-$(VERSION).tar.gz
29SRCS:=$(shell find ./AUTHORS ./COPYING ./Makefile ./Makefile.conf.in ./News \
30 ./configure.ac \
31 ./mkelfImage.spec.in \
32 ./config \
33 ./kunzip_src \
34 ./main ./util ./include ./arch \
35 ./linux-i386 \
36 ./linux-ia64 \
37 ! -path '*CVS*' ! -name '*~' ! -name '.*' -type f -print )
38SRCS+=$(GENERATED_SRCS)
39PSRCS:=$(patsubst ./%,mkelfImage-$(VERSION)/%,$(SRCS))
40PSRCS+=./mkelfImage-$(VERSION).spec
41
42SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage
43MAN8_TARGETS=$(OBJDIR)/man/man8/mkelfImage.8
44
45TARGETS:=$(SBIN_TARGETS) $(MAN8_TARGETS)
46
47DEPS:= Makefile Makefile.conf
48all: $(TARGETS)
49
50include main/Makefile
51include util/Makefile
52include linux-i386/Makefile
53include linux-ia64/Makefile
54
55
56clean::
57 @$(RM) -rf objdir
58 @$(RM) -rf rpm
59 @$(RM) -f config.log config.status config.cache
60 @$(RM) -f $(SBIN_TARGETS) $(MAN1_TARGETS)
61 @$(RM) -f mkelfImage-$(VERSION) $(TARBALL)
62
63dist-clean:: clean
64 @$(FIND) . -type f -name '*~' | xargs $(RM) -f
65 @$(RM) Makefile.conf
66
67maintainer-clean:: dist-clean
68 @$(RM) -f $(SPEC) $(GENERATED_SRCS)
69
70
71install: $(TARGETS)
72 $(MKDIR) -p $(DESTDIR)/$(pkgdatadir)/elf32-i386/ $(DESTDIR)/$(sbindir) $(DESTDIR)/$(mandir)/man8
73 $(CP) -ar $(SBIN_TARGETS) $(DESTDIR)/$(sbindir)/
74 $(CP) -ar $(MAN8_TARGETS) $(DESTDIR)/$(mandir)/man8/
75
76
77#%.1 : %.pl Makefile
78# mkdir -p $(@D)
79# pod2man --date="$(RELEASE_DATE)" --release="$(VERSION)" $*.pl > $@
80
81
82tarball: $(TARBALL)
83
84
85$(TARBALL): $(SRCS) $(SPEC)
86 $(MKDIR) -p $(OBJDIR)
87 $(RM) -f $(OBJDIR)/mkelfImage-$(VERSION)
88 $(LN) -s .. $(OBJDIR)/mkelfImage-$(VERSION)
89 (cd $(OBJDIR); $(TAR) -cf - $(PSRCS) | gzip -9) > $@
90
91rpm: $(TARBALL)
92 $(MKDIR) -p $(OBJDIR)/RPM $(OBJDIR)/SRPM $(OBJDIR)/BUILD $(OBJDIR)/SPECS $(OBJDIR)/TMP
93 unset MAKEFLAGS MAKELEVEL; \
94 $(RPM) -ta \
95 --define '_rpmdir $(CWD)/$(OBJDIR)/RPM' \
96 --define '_srcrpmdir $(CWD)/$(OBJDIR)/SRPM' \
97 --define '_builddir $(CWD)/$(OBJDIR)/BUILD' \
98 --define '_specdir $(CWD)/$(OBJDIR)/SPECS' \
99 --define '_tmppath $(CWD)/$(OBJDIR)/TMP' \
100 $(TARBALL)
101
102Makefile.conf: Makefile.conf.in configure
103 /bin/sh ./configure
104
105
106configure: configure.ac
107 autoconf
108 $(RM) -rf autom4te.cache
109
110$(SPEC): mkelfImage.spec.in Makefile
111 $(SED) -e 's,^Version: $$,Version: $(VERSION),' $< > $@
112
113
114.PHONY: echo install realinstall
115
116
117echo:
118 echo $(SRCS)