1# 2# OS/2 GNU Makefile for building libiconv with GNU Make and GNU C compiler 3# 4# This makefile will build iconv.dll, iconv.a (the import library for ICONV.DLL) 5# and iconv_s.a (static library). 6# 7# You will need the Unicode API add-on for EMX, which is included with latest 8# distributions of gcc for OS/2 (gcc 3.0 and later). 9# 10 11# Use CMD.EXE as shell since its way faster 12SHELL = $(COMSPEC) 13 14# Pack the DLL and executables with lxlite 15LXLITE = 1 16 17# Tools 18CC = gcc -c 19CFLAGS = -s -O2 -Wall -Zmt $(INCLUDE) $(DEFS) 20INCLUDE = -I. 21 22LD = gcc 23LDFLAGS.SHARED = -s -Zmt -Zcrtdll -Zdll 24LIBS = -lgcc 25 26AR = ar 27ARFLAGS = crs 28 29.SUFFIXES: 30.SUFFIXES: .o .a .def .dll 31 32.PHONY: all clean 33 34ICONV.VERSION = 0.0.1 35ICONV.OBJECTS = iconv.o 36 37# How to compile a .c file 38$(OUT)%.o: %.c 39 $(CC) $(CFLAGS) -o $@ $< 40 41# How to build an import library from a .DEF file 42$(OUT)%.a: $(OUT)%.def 43 emximp -o $@ $< 44 45all: iconv.dll iconv.a iconv_s.a 46 47clean: 48 rm -rf *.o iconv.dll iconv*.a iconv.def 49 50iconv_s.a: $(ICONV.OBJECTS) 51 $(AR) $(ARFLAGS) $@ $^ 52 53$(OUT)iconv.def: $(ICONV.OBJECTS) 54 @echo LIBRARY ICONV INITINSTANCE TERMINSTANCE>$@ 55 @echo DESCRIPTION "iconv API library version $(ICONV.VERSION)">>$@ 56 @echo DATA MULTIPLE NONSHARED>>$@ 57 @echo EXPORTS>>$@ 58 emxexp $^ >>$@ 59 60$(OUT)iconv.dll: $(ICONV.OBJECTS) $(OUT)iconv.def 61 $(LD) $(LDFLAGS.SHARED) -o $@ $^ $(LIBS) 62ifeq ($(LXLITE),1) 63 lxlite $@ 64endif 65