aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2001-10-09 06:47:03 +0000
committerH. Peter Anvin <hpa@zytor.com>2001-10-09 06:47:03 +0000
commitd20f1d7701fae2cf2f0c4ae7720fea6bd302d415 (patch)
treeae04f9e61d3b6d56220f4deb0b6f766ced403440 /Makefile
parenta5c4ef9ffa36590b5786e2983a95309a49b69bc3 (diff)
downloadlpsm-d20f1d7701fae2cf2f0c4ae7720fea6bd302d415.tar.gz
lpsm-d20f1d7701fae2cf2f0c4ae7720fea6bd302d415.tar.xz
lpsm-d20f1d7701fae2cf2f0c4ae7720fea6bd302d415.zip
Create a Makefile; fix memory-overwrite bug when file_len > requested_len
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a44be9f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,45 @@
+TEST = teststore test_mmap ftrunctest
+SONAME = libobjstore.so.0
+VERSION = 0.0.1
+OBJSTORE = libobjstore.so libobjstore.a
+
+OSOBJ = objstore.o
+OSPICOBJ = $(patsubst %.o,%.pic.o,$(OSOBJ))
+
+CC = gcc
+CFLAGS = -O2 -g
+PICFLAGS = $(CFLAGS) -fPIC
+SOFLAGS = -shared
+
+AR = ar cq
+RANLIB = ranlib
+
+all: $(OBJSTORE) $(TEST)
+
+clean:
+ rm -f *.o *~ core $(OBJSTORE) $(TEST)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+%.pic.o: %.c
+ $(CC) $(PICFLAGS) -o $@ -c $<
+
+libobjstore.so: $(OSPICOBJ)
+ $(CC) $(SOFLAGS) -Wl,-soname,$(SONAME) -o libobjstore.so.$(VERSION) $(OSPICOBJ)
+ ln -sf libobjstore.so.$(VERSION) $(SONAME)
+ ln -sf libobjstore.so.$(VERSION) libobjstore.so
+
+libobjstore.a: $(OSOBJ)
+ rm -f libobjstore.a
+ $(AR) libobjstore.a $(OSOBJ)
+ $(RANLIB) libobjstore.a
+
+teststore: teststore.o libobjstore.a
+ $(CC) $(LDFLAGS) -o $@ $< libobjstore.a
+
+test_mmap: test_mmap.o
+ $(CC) $(LDFLAGS) -o $@ $<
+
+ftrunctest: ftrunctest.o
+ $(CC) $(LDFLAGS) -o $@ $<