summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile23
-rw-r--r--dmidecodemodule.c12
2 files changed, 15 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 1a0c1f7..d5c4a79 100644
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,8 @@ PY := $(shell python -V 2>&1 |sed -e 's/.\(ython\) \(2\.[0-9]\)\..*/p\1\2/')
CC := gcc
RM := rm -f
-CFLAGS = -D_XOPEN_SOURCE=600
-CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef #-Wcast-qual
+CFLAGS = -D_XOPEN_SOURCE=600 -O2
+#CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef #-Wcast-qual
CFLAGS += -pthread -fno-strict-aliasing -DNDEBUG -fPIC
CFLAGS += -I/usr/include/$(PY)
CFLAGS += -g -DNDEBUG
@@ -19,23 +19,24 @@ CFLAGS += -g -DNDEBUG
#CFLAGS += -DBIGENDIAN
#CFLAGS += -DALIGNMENT_WORKAROUND
+#LDFLAGS = -lefence
+LDFLAGS =
-#gcc -D_XOPEN_SOURCE=600 -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef -pthread -fno-strict-aliasing -DNDEBUG -fPIC -I/usr/include/python2.4 -L. -g -DNDEBUG -lpython -c -lutil -lpython -o dmidecodemodule.o dmidecodemodule.c *.o
-#gcc -pthread -shared -L/home/nima/dev-room/projects/dmidecode -lutil -o build/lib.linux-i686-2.4/dmidecode.so
-
-LDFLAGS = -I/usr/include/$(PY) -lefence
-
-SOFLAGS = -shared -fPIC -L/usr/include/$(PY) -L/home/nima/dev-room/projects/dmidecode -lutil
+SOFLAGS = -pthread -shared -L/home/nima/dev-room/projects/dmidecode -lutil
#
# Shared Objects
#
+
+/usr/lib/$(PY)/site-packages/dmidecode.so: libdmidecode.so
+ cp $< $@
+ nm -u $@
+
libdmidecode.so: dmihelper.o util.o dmioem.o dmidecode.o dmidecodemodule.o
$(CC) $(LDFLAGS) $(SOFLAGS) $^ -o $@
- cp $@ /usr/lib/python2.4/site-packages/dmidecode.so
-dmidecodemodule.o: dmidecodemodule.c #dmidecodemodule.h dmihelper.o util.o dmioem.o dmidecode.o
- $(CC) $(CFLAGS) -c -o $@ $< #dmihelper.o util.o dmioem.o dmidecode.o
+dmidecodemodule.o: dmidecodemodule.c
+ $(CC) $(CFLAGS) -c -o $@ $<
dmidecode.o: dmidecode.c version.h types.h util.h config.h dmidecode.h dmioem.h
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/dmidecodemodule.c b/dmidecodemodule.c
index 75d4101..0eeabbb 100644
--- a/dmidecodemodule.c
+++ b/dmidecodemodule.c
@@ -65,7 +65,7 @@ u8 *parse_opt_type(u8 *p, const char *arg) {
static PyObject* dmidecode_get(PyObject *self, const char* section) {
- if(self == NULL) return NULL;
+ //if(self == NULL) return NULL;
//mtrace();
@@ -85,12 +85,6 @@ static PyObject* dmidecode_get(PyObject *self, const char* section) {
int efi;
u8 *buf;
- if(sizeof(u8)!=1 || sizeof(u16)!=2 || sizeof(u32)!=4 || '\0'!=0) {
- fprintf(stderr, "%s: compiler incompatibility\n", "dmidecodemodule");
- //exit(255);
- return NULL;
- }
-
/* Set default option values */
opt.devmem = DEFAULT_MEM_DEV;
opt.flags=0;
@@ -194,13 +188,13 @@ static PyObject* dmidecode_dump(PyObject *self, PyObject *args) { return Py_Fals
static PyObject* dmidecode_load(PyObject *self, PyObject *args) { return Py_False; }
static PyObject* dmidecode_get_dev(PyObject *self, PyObject *null) {
- if(self == NULL) return NULL;
+ //if(self == NULL) return NULL;
if(opt.dumpfile != NULL) return opt.dumpfile;
else return PyString_FromString(opt.devmem);
}
static PyObject* dmidecode_set_dev(PyObject *self, PyObject *arg) {
- if(self == NULL) return NULL;
+ //if(self == NULL) return NULL;
if(PyString_Check(arg)) {
if(opt.dumpfile) { Py_DECREF(opt.dumpfile); }
opt.dumpfile = arg;