summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile91
1 files changed, 28 insertions, 63 deletions
diff --git a/Makefile b/Makefile
index 8e69bb5..107dbdb 100644
--- a/Makefile
+++ b/Makefile
@@ -3,95 +3,60 @@
#.
#. (C) 2008 Nima Talebi <nima@it.net.au>
#.
-#. Licensed under the GNU Public License v3
+#. Licensed under the GNU Public License v2
#.
-VERSION := 2.10
-PY := $(shell python -V 2>&1 |sed -e 's/.\(ython\) \(2\.[0-9]\)\..*/p\1\2/')
-PY_VER := $(subst python,,$(PY))
+VERSION := $(shell cd src;python -c "from setup_common import *; print get_version();")
PACKAGE := python-dmidecode
-SRCSRV := /var/www/nima/sites/src.autonomy.net.au/pub
+PY_VER := $(shell python -c 'import sys; print "%d.%d"%sys.version_info[0:2]')
+PY := python$(PY_VER)
+SO = build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecodemod.so
-CC := gcc
-RM := rm -f
-SRC_D := src
-OBJ_D := lib
-CFLAGS = -g -D_XOPEN_SOURCE=600
-CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align
-CFLAGS += -Wwrite-strings -Wmissing-prototypes -Winline -Wundef #-Wcast-qual
-CFLAGS += -pthread -fno-strict-aliasing -DNDEBUG -fPIC
-CFLAGS += -I/usr/include/$(PY)
-CFLAGS += -O3
-#CFLAGS += -DNDEBUG
-#CFLAGS += -DBIGENDIAN
-#CFLAGS += -DALIGNMENT_WORKAROUND
-#LDFLAGS = -lefence
-LDFLAGS =
-SOFLAGS = -pthread -shared -L/home/nima/dev-room/projects/dmidecode -lutil
-SO = build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecode.so
-
-#. Search
-vpath %.o $(OBJ_D)
-vpath %.c $(SRC_D)
-vpath %.h $(SRC_D)
-vpath % $(OBJ_D)
+###############################################################################
+.PHONY: build dmidump install uninstall clean tarball rpm unit version
+all : build dmidump
-###############################################################################
-build: $(PY)-dmidecode.so
-$(PY)-dmidecode.so: $(SO)
+build: $(PY)-dmidecodemod.so
+$(PY)-dmidecodemod.so: $(SO)
cp $< $@
-
-build: $(SO)
$(SO):
$(PY) src/setup.py build
+dmidump : src/util.o src/efi.o
+ $(CC) -o $@ src/dmidump.c $^ -g -Wall -D_DMIDUMP_MAIN_
+
install:
$(PY) src/setup.py install
uninstall:
$(PY) src/setup.py uninstall
-clean :
- dh_clean
- $(PY) src/setup.py clean
- -$(RM) *.so lib/*.o core
- -rm -rf build .dpkg
+clean:
+ -$(PY) src/setup.py clean --all
+ -rm -f *.so lib/*.o core dmidump
+ -rm -rf build
+ -rm -rf rpm
+ -rm -rf src/setup_common.py[oc]
+ -rm -rf $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION).tar.gz
+ $(MAKE) -C unit-tests clean
tarball:
rm -rf $(PACKAGE)-$(VERSION)
mkdir $(PACKAGE)-$(VERSION)
- cp -r contrib doc examples lib Makefile man README src $(PACKAGE)-$(VERSION)
+ cp -r contrib doc examples Makefile man README src dmidecode.py $(PACKAGE)-$(VERSION)
tar -czvf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
-rpm: tarball
- rm -rf rpm
+rpm: tarball
mkdir -p rpm/{BUILD,RPMS,SRPMS,SPECS,SOURCES}
cp contrib/$(PACKAGE).spec rpm/SPECS
cp $(PACKAGE)-$(VERSION).tar.gz rpm/SOURCES
rpmbuild -ba --define "_topdir $(shell pwd)/rpm" rpm/SPECS/$(PACKAGE).spec
-###############################################################################
-libdmidecode.so: dmihelper.o util.o dmioem.o dmidecode.o dmidecodemodule.o
- $(CC) $(LDFLAGS) $(SOFLAGS) $^ -o $@
-
-$(OBJ_D)/dmidecodemodule.o: dmidecodemodule.c
- $(CC) $(CFLAGS) -c -o $@ $<
+unit:
+ $(MAKE) -C unit-tests
-$(OBJ_D)/dmidecode.o: dmidecode.c version.h types.h util.h config.h dmidecode.h dmioem.h
- $(CC) $(CFLAGS) -c -o $@ $<
+version:
+ @echo "python-dmidecode: $(VERSION)"
+ @echo "python version: $(PY_VER) ($(PY))"
-$(OBJ_D)/dmihelper.o: dmihelper.c dmihelper.h
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(OBJ_D)/util.o: util.c types.h util.h config.h
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(OBJ_D)/dmioem.o: dmioem.c types.h dmidecode.h dmioem.h
- $(CC) $(CFLAGS) -c -o $@ $<
-
-
-
-###############################################################################
-.PHONY: install clean uninstall build dupload
-.PHONY: srcsrv binary source orig.tar.gz all