1# 2# Country Codes Makefile 3# 4 5# 6# Modify this, if you need to and if you know what you are doing. 7# 8 9prefix ?= /usr/local 10bindir ?= ${prefix}/bin 11 12mandir ?= ${MANPREFIX}/man/man1 13 14# For system that doesn't support mkdir -p. 15# If you have Linux, don't bother. 16 17MKDIRECTORY = mkdir -p 18 19# Mode for user binaries 20BINMODE=755 21 22# Mode for the log directory 23LOGDIRMODE=700 24 25# Compiler to use 26CC?=gcc 27 28# Compiler warnings 29#WARNINGS= -pedantic -Wall 30 31# Compiler flags 32CCOPTS = ${CFLAGS} 33 34# The makefile standards document I read says that I have to put it here... 35SHELL = /bin/sh 36 37# Clear and set suffixes 38.SUFFIXES: 39.SUFFIXES: .c .o 40 41# Install program 42INSTALL ?= install 43 44# Miscellaneous 45COCO_VERSION = 1.0.6 46RELEASEDATE = 2017-02-26 47 48# Location of sed 49SEDBIN = sed 50 51# sed command 52SEDCMDS = "s/@version@/$(COCO_VERSION)/g;s/@releasedate@/$(RELEASEDATE)/g" 53 54ISO3166OBJ = iso3166.o common.o 55 56PROGRAM = iso3166 57 58all: $(PROGRAM) 59 60$(PROGRAM): $(ISO3166OBJ) 61 $(CC) $(CCOPTS) $(ISO3166OBJ) -o $@ 62 63clean: 64 $(RM) $(ISO3166OBJ) core defines.h $(PROGRAM) 65 66strip: 67 strip $(PROGRAM) 68 69install: strip 70 $(MKDIRECTORY) $(DESTDIR)/${bindir} $(DESTDIR)/${mandir} 71 $(INSTALL) -m $(BINMODE) $(PROGRAM) $(DESTDIR)/${bindir} 72 @echo "Installing man page..." 73 $(INSTALL) -m 644 iso3166.1 $(DESTDIR)/${mandir} 74 75update-man: 76 @$(SEDBIN) $(SEDCMDS) iso3166.1.in > iso3166.1 77 78uninstall: 79 $(RM) ${bindir}/$(PROGRAM) 80 $(RM) ${mandir}/iso3166.1 81 82.c.o: 83 $(CC) $(CCOPTS) $(WARNINGS) -c $< 84 85$(ISO3166OBJ): common.h defines.h protos.h tables.h 86 87defines.h: 88 @echo "Creating file \"defines.h\"" 89 @echo "/*" >> defines.h 90 @echo " Global #defines for Country Codes" >> defines.h 91 @echo " Copyright © 1999, 2000 Diego Javier Grigna <diego@grigna.com>" >> defines.h 92 @echo " © 2017 Johnny A. Solbu <johnny@solbu.net>" >> defines.h 93 @echo "" >> defines.h 94 @echo " File automatically created by the Makefile." >> defines.h 95 @echo " Do not edit by hand, modify the Makefile instead." >> defines.h 96 @echo "*/" >> defines.h 97 @echo "" >> defines.h 98 @echo "#define COCO_VERSION \"$(COCO_VERSION)\"" >> defines.h 99 @echo "" >> defines.h 100 101TARFILE = countrycodes-$(COCO_VERSION).tar.gz 102 103release: 104 git archive --prefix=countrycodes-$(COCO_VERSION)/ HEAD -o ../$(TARFILE) 105 106upload-sf: 107 rsync -avh --progress ../$(TARFILE) solbu@frs.sourceforge.net:/home/frs/project/countrycodes/$(COCO_VERSION)/ 108