1# $Id$ 2# Makefile to build fidoconfig / QNX6. 3# No support for the Husky build environment. 4 5# Uncomment this for compile info for gdb and display more compiler warnings 6# DEBUG = -g -pedantic 7 8# Uncomment this for strip all simbols from binaries to reduce file sizes 9STRIPLIB = strip -g 10STRIPDLL = strip --strip-unneeded 11STRIPPROGRAM = strip 12 13## programs ## 14 15# compiler 16CC = gcc 17# library tool 18AR = ar 19# library indexer 20RANLIB = ranlib 21# linker program 22LINK = ld 23# archiver program 24ARCHIVER= zip 25# file removing command 26RM = rm 27# create directory command 28MKDIR = mkdir 29# remove directory command 30RMDIR = rm 31# install command 32INSTALL = install 33# copy command 34CP = cp 35# move command 36MV = mv 37# groff program (man pages formatter, possible use man2html perl script) 38GROFF = groff 39# ln, to make soft links 40LN = ln 41 42 43## file suffixes ## 44 45# source file 46_C = .c 47# object file 48_LIBOBJ = .o 49# dynamic object file 50_DLLOBJ = .xo 51# static library 52_LIB = .a 53# shared library 54_DLL = .so 55# archive (package) file 56_ARC = .zip 57# documentation file (".info", ".html", ".div", ...) 58_HTML = .html 59# text file 60_TXT = .txt 61 62 63## program options ## 64 65# compiler defines 66CDEFS = 67# common compiler options 68CFLAGS = -O2 -Wall 69# includes directories 70CINCL = -I../../smapi/ -I../../huskylib/ 71# options for compile only (link is off) 72OBJOPT = -c 73# option for specify output file name 74NAMEOPT = -o 75# options for build dll 76DLLOPT = -fPIC -shared 77# options for link dll 78DLLLINKOPT = -L../../smapi/make/ -L../../huskylib/make/ -L. 79# option for specify output file name 80EXENAMEFLAG= -o 81# options for $(AR) program 82ARFLAGS = rs 83# options for $(RM) program 84RMFLAGS = -f 85# options for archiver 86ARCFLAGS= -9r 87# create directory command options 88MKDIROPT= -p 89# remove directory command options 90RMDIROPT= -rf 91# copy command options 92CPOPT = -f 93# move command options 94MVOPT = -uf 95# install command options 96INSTOPT = -c 97# groff program option (this example doing format man page to html page) 98GROFFOPT= -Thtml -mman 99 100_SRC_DIR=../src/ 101 102## Library filename elements ## 103 104# Prefix to construct static library name 105LIBPREFIX=lib 106# Prefix to construct dll name 107DLLPREFIX=lib 108# Suffix to construct library name 109LIBSUFFIX=qnx 110# Suffix to construct dll name 111DLLSUFFIX=qnx 112 113## Binary package name ## 114PACKAGEBASE=$(LIBNAME)$(LIBPREFIX)-$(LIBSUFFIX)-$(VERH) 115PACKAGENAME=$(LIBNAME)$(LIBPREFIX)-$(LIBSUFFIX)-$(VERH)$(_ARC) 116 117## make directives ## 118 119.PHONY: distclean clean all static dll programs default 120 121## Default make rule ## 122 123default: all 124 125## include common makefiles part ## 126 127ifeq (~$(SHORTNAMES)~, ~1~) 128include fn_short.inc 129else 130include fn_long.inc 131endif 132_OBJ:=$(_DLLOBJ) 133include makefile.inc 134DLLOBJS:=$(LOBJS) 135 136_OBJ:=$(_LIBOBJ) 137include makefile.inc 138LIBOBJS:=$(LOBJS) 139 140TARGETDLL:=$(DLLPREFIX)$(LIBNAME)$(DLLSUFFIX)-$(VER)$(_DLL) 141 142# libraries need to build binary file 143SLIBS=-L../../smapi/make -lsmapiqnx 144DYNLIBS = -L. -lfidoconfigqnx 145STATLIBS = ../../huskylib/make/$(LIBPREFIX)husky$(LIBSUFFIX)$(_LIB) ../../smapi/make/$(LIBPREFIX)smapi$(LIBSUFFIX)$(_LIB) $(LIBPREFIX)$(LIBNAME)$(LIBSUFFIX)$(_LIB) 146LIBS=$(DYNLIBS) 147 148## Additions (add into end of strings) ## 149CFLAGS += -I../fidoconf $(DEBUG) 150 151## make rules ## 152 153all: static dll programs 154 155static: $(TARGETLIB) 156dll: $(TARGETDLL) 157programs: $(TARGETLIB) $(PROGRAMS) 158dllprograms: $(TARGETDLL) $(PROGRAMS) 159 160%$(_LIBOBJ): $(_SRC_DIR)%$(_C) 161 $(CC) $(CFLAGS) $(CDEFS) $(CINCL) $(OBJOPT) $(NAMEOPT)$@ $< 162%$(_DLLOBJ): $(_SRC_DIR)%$(_C) 163 $(CC) $(DLLOPT) $(CFLAGS) $(CDEFS) $(CINCL) $(OBJOPT) $(NAMEOPT)$@ $< 164 165$(TARGETLIB): $(LIBOBJS) 166 $(AR) $(ARFLAGS) $@ $(LIBOBJS) 167 $(RANLIB) $@ 168 $(STRIPLIB) $@ 169 170$(TARGETDLL): $(DLLOBJS) 171 $(CC) $(DLLOPT) $(DLLLINKOPT) $(CFLAGS) $(SLIBS) $(NAMEOPT)$@ $^ 172 $(STRIPDLL) $@ 173 $(LN) -f -s $@ $(DLLPREFIX)$(LIBNAME)$(DLLSUFFIX)$(_DLL) 174 175clean: 176 -$(RM) $(RMOPT) *$(_LIBOBJ) *$(_DLLOBJ) $(PROGRAMS) $(TARGETDLL) $(TARGETLIB) $(DLLPREFIX)$(LIBNAME)$(DLLSUFFIX)$(_DLL) 177 178distclean: clean 179 -$(RM) $(RMOPT) $(TARGETDLL) $(TARGETLIB) $(PROGRAMS) 180 181doc: 182 cd ../doc ; make html 183 184pkg-dir: 185 $(MKDIR) $(MKDIROPT) $(PACKAGEBASE) 186 187pkg-doc-dir: 188 $(MKDIR) $(MKDIROPT) $(PACKAGEBASE)/doc 189 190pkg-doc: pkg-doc-dir 191 $(CP) $(CPOPT) ../doc $(PACKAGEBASE)/doc 192 193pkg-readme: 194 @echo husky library v.$(VERH) for `uname -s` platform > $(PACKAGEBASE)/file_id.diz 195 @echo "(Part of HUSKY Fidonet Software Project)" >> $(PACKAGEBASE)/file_id.diz 196 @echo See http://husky.sourceforge.net and/or >> $(PACKAGEBASE)/file_id.diz 197 @echo http://sourceforge.net/projects/husky >> $(PACKAGEBASE)/file_id.diz 198 $(CP) $(CPOPT) ../COPYING ../cvsdate.h ../INSTALL ../TODO $(PACKAGEBASE) 199 $(CP) $(CPOPT) ../HISTORY ../ChangeLog ../VERSION $(PACKAGEBASE) 200 201pkg-man: pkg-doc-dir 202 for f in ../man/*.? ; \ 203 do $(GROFF) $(GROFFOPT) $$f > $(PACKAGEBASE)/doc/`basename $$f`$(_HTML) ; done 204 205pkg-h-dir: pkg-dir 206 $(MKDIR) $(MKDIROPT) $(PACKAGEBASE)/$(LIBNAME)/ 207 208$(HEADERS): pkg-h-dir 209 $(CP) $(CPOPT) $(H_DIR)$@ $(PACKAGEBASE)/$(LIBNAME)/$@ 210 211pkg-h: $(HEADERS) 212 213pkg-bin-dir: 214 -$(MKDIR) $(MKDIROPT) $(PACKAGEBASE)/bin 215 216pkg-bin-static: static programs pkg-bin-dir 217 $(CP) $(CPOPT) $(TARGETLIB) $(PROGRAMS) $(PACKAGEBASE)/bin 218 219pkg-bin-dll: dll programs pkg-bin-dir 220 $(CP) $(CPOPT) $(TARGETDLL) $(PROGRAMS) $(PACKAGEBASE)/bin 221 222 223package-static: pkg-dir pkg-h pkg-man pkg-readme pkg-bin-static 224 $(ARCHIVER) $(ARCFLAGS) $(PACKAGENAME) $(PACKAGEBASE)/* 225 226package-dll: pkg-dir pkg-h pkg-man pkg-readme pkg-bin-dll 227 $(ARCHIVER) $(ARCFLAGS) $(PACKAGENAME) $(PACKAGEBASE)/* 228 229package: 230 @echo Run 'make package-dll' to build package with dll version 231 @echo Run 'make package-static' to build with static version 232 233pkgclean: 234 -$(RMDIR) $(RMDIROPT) $(PACKAGEBASE) 235 236pkgdistclean: pkgclean 237 -$(RM) $(RMOPT) $(PACKAGENAME) 238 239pkg-distclean: pkgdistclean 240pkg-clean: pkgclean 241