--- libaio-0.3.109.orig/src/Makefile	2009-10-09 20:17:02.000000000 +0200
+++ libaio-0.3.109/src/Makefile	2012-08-18 12:47:38.000000000 +0200
@@ -3,7 +3,8 @@ includedir=$(prefix)/include
 libdir=$(prefix)/lib
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/)
-CFLAGS := -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -O2 -fPIC
+CFLAGS ?= -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -O2 -fPIC
+CFLAGS += -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -O2 -fPIC
 SO_CFLAGS=-shared $(CFLAGS)
 L_CFLAGS=$(CFLAGS)
 LINK_FLAGS=
@@ -51,9 +52,10 @@ $(libname): $(libaio_sobjs) libaio.map
 	$(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
 
 install: $(all_targets)
-	install -D -m 644 libaio.h $(includedir)/libaio.h
-	install -D -m 644 libaio.a $(libdir)/libaio.a
-	install -D -m 755 $(libname) $(libdir)/$(libname)
+	mkdir -p $(includedir) $(libdir)
+	install -m 644 libaio.h $(includedir)/libaio.h
+	install -m 644 libaio.a $(libdir)/libaio.a
+	install -m 755 $(libname) $(libdir)/$(libname)
 	ln -sf $(libname) $(libdir)/$(soname)
 	ln -sf $(libname) $(libdir)/libaio.so
 
