--- src/Makefile.orig	2006-07-09 19:46:41.000000000 -0700
+++ src/Makefile	2006-07-09 19:51:00.000000000 -0700
@@ -2,11 +2,10 @@
 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
-SO_CFLAGS=-shared $(CFLAGS)
+CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
+SO_CFLAGS=-shared $(CFLAGS)
 L_CFLAGS=$(CFLAGS)
-LINK_FLAGS=
+LINK_FLAGS=-lgcc -lrt $(LDFLAGS)
 
 soname=libaio.so.1
 minor=0
@@ -48,7 +47,7 @@
 	ranlib libaio.a
 
 $(libname): $(libaio_sobjs) libaio.map
-	$(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
+	$(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
