Stefan Reinauer | b34eea3 | 2008-02-15 18:16:06 +0000 | [diff] [blame] | 1 | include Makefile.conf |
| 2 | VERSION:=2.7 |
| 3 | RELEASE_DATE:=27 March 2006 |
| 4 | PACKAGE:=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 |
| 9 | DESTDIR = |
| 10 | CWD:=$(shell pwd) |
| 11 | OBJDIR:=objdir |
| 12 | |
| 13 | pkgdatadir = $(datadir)/$(PACKAGE) |
| 14 | pkglibdir = $(libdir)/$(PACKAGE) |
| 15 | pkgincludedir = $(includedir)/$(PACKAGE) |
| 16 | |
| 17 | CPPFLAGS=-DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(RELEASE_DATE)"' -I include |
| 18 | HOST_CPPFLAGS=$(CPPFLAGS) |
| 19 | I386_CPPFLAGS=$(CPPFLAGS) -I arch/i386/include |
| 20 | IA64_CPPFLAGS=$(CPPFLAGS) -I arch/ia64/include |
| 21 | |
| 22 | GENERATED_SRCS:=\ |
| 23 | ./configure \ |
| 24 | ./linux-i386/convert.bin.c\ |
| 25 | ./linux-ia64/convert.bin.c |
| 26 | |
| 27 | SPEC=$(OBJDIR)/mkelfImage-$(VERSION).spec |
| 28 | TARBALL=$(OBJDIR)/mkelfImage-$(VERSION).tar.gz |
| 29 | SRCS:=$(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 ) |
| 38 | SRCS+=$(GENERATED_SRCS) |
| 39 | PSRCS:=$(patsubst ./%,mkelfImage-$(VERSION)/%,$(SRCS)) |
| 40 | PSRCS+=./mkelfImage-$(VERSION).spec |
| 41 | |
| 42 | SBIN_TARGETS=$(OBJDIR)/sbin/mkelfImage |
| 43 | MAN8_TARGETS=$(OBJDIR)/man/man8/mkelfImage.8 |
| 44 | |
| 45 | TARGETS:=$(SBIN_TARGETS) $(MAN8_TARGETS) |
| 46 | |
| 47 | DEPS:= Makefile Makefile.conf |
| 48 | all: $(TARGETS) |
| 49 | |
| 50 | include main/Makefile |
| 51 | include util/Makefile |
| 52 | include linux-i386/Makefile |
| 53 | include linux-ia64/Makefile |
| 54 | |
| 55 | |
| 56 | clean:: |
| 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 | |
| 63 | dist-clean:: clean |
| 64 | @$(FIND) . -type f -name '*~' | xargs $(RM) -f |
| 65 | @$(RM) Makefile.conf |
| 66 | |
| 67 | maintainer-clean:: dist-clean |
| 68 | @$(RM) -f $(SPEC) $(GENERATED_SRCS) |
| 69 | |
| 70 | |
| 71 | install: $(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 | |
| 82 | tarball: $(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 | |
| 91 | rpm: $(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 | |
| 102 | Makefile.conf: Makefile.conf.in configure |
| 103 | /bin/sh ./configure |
| 104 | |
| 105 | |
| 106 | configure: 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 | |
| 117 | echo: |
| 118 | echo $(SRCS) |