| 1 |
## Please read the README in this directory to see how to use this |
| 2 |
## Makefile snippet |
| 3 |
|
| 4 |
# Let's use whatever clean target the specific app provides |
| 5 |
|
| 6 |
CONTROL = `if test -e familiar/control1; then echo control1; else echo control; fi` |
| 7 |
|
| 8 |
# URL to source tarball |
| 9 |
SOURCE = ftp://gpe.handhelds.org/gpe/source/$(PACKAGE)-$(VERSION).tar.gz |
| 10 |
|
| 11 |
# can change this to e.g. /var/tmp/deb |
| 12 |
DEB_PATH = ../deb |
| 13 |
|
| 14 |
ifeq ($(CVSBUILD),yes) |
| 15 |
LIBGPEWIDGET_PC = libgpewidget-uninstalled |
| 16 |
PC_EXTRA=PKG_CONFIG_PATH=../../base/libgpewidget |
| 17 |
else |
| 18 |
LIBGPEWIDGET_PC = libgpewidget |
| 19 |
endif |
| 20 |
|
| 21 |
ifeq ($(IN_LIBGPEWIDGET),) |
| 22 |
GPECFLAGS = $(shell $(PC_EXTRA) pkg-config --cflags $(LIBGPEWIDGET_PC)) |
| 23 |
GPELIBS = $(shell $(PC_EXTRA) pkg-config --libs $(LIBGPEWIDGET_PC)) |
| 24 |
endif |
| 25 |
|
| 26 |
GTKCFLAGS = $(shell pkg-config --cflags gtk+-2.0) |
| 27 |
GTKLIBS = $(shell pkg-config --libs gtk+-2.0) |
| 28 |
|
| 29 |
STANDARD_CPPFLAGS = -D_GNU_SOURCE -DPACKAGE=\"$(PACKAGE)\" -DPREFIX=\"$(PREFIX)\" -DPACKAGE_LOCALE_DIR=\"$(PREFIX)/share/locale\" |
| 30 |
STANDARD_CFLAGS = -MD -Wall |
| 31 |
|
| 32 |
ifeq ($(DEBUG),yes) |
| 33 |
CFLAGS += -O2 -g |
| 34 |
LDFLAGS = -g |
| 35 |
else |
| 36 |
CFLAGS += -Os -fomit-frame-pointer |
| 37 |
endif |
| 38 |
|
| 39 |
dist: check-source clean dist-prep |
| 40 |
rm -rf ../$(PACKAGE)-$(VERSION) |
| 41 |
mkdir ../$(PACKAGE)-$(VERSION) |
| 42 |
( tar cf - --exclude "*/CVS" --exclude CVS --exclude "*~" --exclude "#*#" --exclude "debian" --exclude ".*" --exclude "*.ipk" --exclude "*.ipk.*" --exclude "*.mo" --exclude "*.batch" --exclude "translation-ipkgs.txt" * ) | (cd ../$(PACKAGE)-$(VERSION); tar xf -) |
| 43 |
( cd ../$(PACKAGE)-$(VERSION); mkdir build; cp $(BUILD)/Makefile.dpkg_ipkg $(BUILD)/Makefile.translation build/ ; sed 's:^CVSBUILD.*:CVSBUILD = no:' < Makefile > Makefile.new; mv Makefile.new Makefile ) |
| 44 |
( cd .. ; tar cf - $(PACKAGE)-$(VERSION) | gzip -9 >$(PACKAGE)-$(VERSION).tar.gz ) |
| 45 |
rm -rf ../$(PACKAGE)-$(VERSION) |
| 46 |
$(MAKE) printinfo |
| 47 |
|
| 48 |
dist-upload: dist |
| 49 |
scp ../$(PACKAGE)-$(VERSION).tar.gz $(USER)@handhelds.org:/home/ftp/pub/projects/gpe/source/ |
| 50 |
|
| 51 |
dist-prep: |
| 52 |
ipkg-prep: |
| 53 |
install-mo: |
| 54 |
# empty, can be filled in Makefile.translation |
| 55 |
|
| 56 |
install: install-program install-mo |
| 57 |
|
| 58 |
clean-dist: |
| 59 |
rm -rf familiar/dist familiar/dist.list |
| 60 |
|
| 61 |
clean: clean-dist |
| 62 |
|
| 63 |
check-source: |
| 64 |
@if ! grep -q '^Source:' familiar/$(CONTROL); then echo -e "\nNo Source: field in control file. Aborting.\n"; exit 1; fi |
| 65 |
|
| 66 |
ipkg: check-source ipkg-prep clean |
| 67 |
rm -rf familiar/dist |
| 68 |
mkdir -p familiar/dist/CONTROL |
| 69 |
sed 's:VERSION:$(VERSION):;s$$SOURCE$$$(SOURCE)$$' < familiar/$(CONTROL) > familiar/dist/CONTROL/control |
| 70 |
if test -e familiar/conffiles; then install -m 644 familiar/conffiles familiar/dist/CONTROL; fi |
| 71 |
if test -e familiar/preinst; then install familiar/preinst familiar/dist/CONTROL; fi |
| 72 |
if test -e familiar/postinst; then install familiar/postinst familiar/dist/CONTROL; fi |
| 73 |
if test -e familiar/prerm; then install familiar/prerm familiar/dist/CONTROL; fi |
| 74 |
if test -e familiar/postrm; then install familiar/postrm familiar/dist/CONTROL; fi |
| 75 |
$(MAKE) DESTDIR=`pwd`/familiar/dist PREFIX=/usr prefix=/usr DEBUG=no install-program |
| 76 |
rm -rf familiar/dist.list |
| 77 |
ipkg-build -o 0 -g 0 familiar/dist | sed 's/^Packaged .*into //; t 1; d; : 1; s:.*/::' >> familiar/dist.list |
| 78 |
if [ "x$(LINGUAS)" != "x" ]; then make translation-ipkg; tr ' ' '\n' < translation-ipkgs.txt >> familiar/dist.list; fi |
| 79 |
md5sum `cat familiar/dist.list` > $(PACKAGE)_$(VERSION).batch |
| 80 |
rm -rf familiar/dist familiar/dist.list |
| 81 |
$(MAKE) printinfo |
| 82 |
|
| 83 |
dpkg: dist |
| 84 |
mkdir -p $(DEB_PATH) |
| 85 |
( olddir=`pwd`; cd $(DEB_PATH); rm -rf $(PACKAGE)-$(VERSION); ln -s $$olddir/../$(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)_$(VERSION).orig.tar.gz ; tar xzf $(PACKAGE)_$(VERSION).orig.tar.gz ) |
| 86 |
mkdir -p $(DEB_PATH)/$(PACKAGE)-$(VERSION)/debian |
| 87 |
for i in debian/*; do if test -f $$i; then cp $$i $(DEB_PATH)/$(PACKAGE)-$(VERSION)/debian/; fi; done |
| 88 |
|
| 89 |
CVSTAG := $(shell echo $(PACKAGE)-$(VERSION) | tr [a-z.] [A-Z_]) |
| 90 |
printinfo: |
| 91 |
@printf '-------------------------------------------------------------------------------\n' |
| 92 |
@printf "If this becomes a package release, please add a CVS tag.\n" |
| 93 |
@printf "You can use 'make tag' for that, it will execute\n" |
| 94 |
@printf " cvs tag %s\n" $(CVSTAG) |
| 95 |
@printf "Please upload a tarball (created with 'make dist') to\n" |
| 96 |
@printf " ftp://ftp.handhelds.org/pub/projects/gpe/\n" |
| 97 |
@printf " (handhelds.org:~ftp/pub/projects/gpe/source)\n" |
| 98 |
@printf "You can use 'make dist-upload' to do that.\n" |
| 99 |
@printf "You are currently known as USER %s.\n" $(USER) |
| 100 |
@printf '-------------------------------------------------------------------------------\n' |
| 101 |
|
| 102 |
tag: check-source |
| 103 |
cvs tag $(CVSTAG) |
| 104 |
|
| 105 |
retag: check-source |
| 106 |
cvs tag -F $(CVSTAG) |
| 107 |
|
| 108 |
source: tag dist-upload |
| 109 |
|
| 110 |
%.pc: %.pc.in |
| 111 |
sed 's:PREFIX:$(PREFIX):;s:BUILDDIR:$(shell pwd):;s:VERSION:$(VERSION):' < $< > $@ |
| 112 |
|
| 113 |
.c.o:; |
| 114 |
$(CC) $(CFLAGS) $(CPPFLAGS) $(PACKAGE_CFLAGS) $(PACKAGE_CPPFLAGS) -c $< -o $@ |