PROJECT_PATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))).. TARGET = powermon-manager BUILD_VERSION = 0.10 DEB_VERSION = 1 UBUNTU_RELEASE := $(word 2, $(shell lsb_release -c)) ARCH_BIT := $(shell getconf LONG_BIT) ifeq ($(ARCH_BIT), 32) ARCH := i386 else ifeq ($(ARCH_BIT), 64) ARCH := amd64 else $(error Invalid architecture) endif DEBDIR = $(OUTDIR)/$(TARGET)-$(UBUNTU_RELEASE)-$(ARCH) PKGNAME = $(subst _,-,$(TARGET)) INSTALL = install ECHO = echo TOUCH = touch FAKEROOT = fakeroot DPKG = dpkg POWERMON_LIB_PATH = $(PROJECT_PATH)/lib/powermon ifeq ($(RELEASE), yes) OPTLEVEL = 3 DBGLEVEL = 0 CPPDEFS = else OPTLEVEL = 3 DBGLEVEL = 3 CPPDEFS = DEBUG endif #C Source files CSRCS := #C++ Source files CXXSRCS = \ $(PROJECT_PATH)/debug.cpp \ $(PROJECT_PATH)/version.cpp \ \ $(PROJECT_PATH)/gui/model.cpp \ $(PROJECT_PATH)/gui/gui_about.cpp \ $(PROJECT_PATH)/gui/gui_app.cpp \ $(PROJECT_PATH)/gui/gui_global.cpp \ $(PROJECT_PATH)/gui/gui_calibrate_dialog.cpp \ $(PROJECT_PATH)/gui/gui_device_config.cpp \ $(PROJECT_PATH)/gui/gui_device.cpp \ $(PROJECT_PATH)/gui/gui_dfu_progress.cpp \ $(PROJECT_PATH)/gui/gui_fg_stats.cpp \ $(PROJECT_PATH)/gui/gui_main.cpp \ $(PROJECT_PATH)/gui/gui_chart.cpp \ $(PROJECT_PATH)/gui/gui_parser.cpp \ $(PROJECT_PATH)/gui/gui_stats.cpp \ $(PROJECT_PATH)/gui/gui_string_dialog.cpp \ $(PROJECT_PATH)/gui/gui_timers_dialog.cpp \ $(PROJECT_PATH)/gui/gui_wifi_setup.cpp \ $(PROJECT_PATH)/gui/scope_display.cpp #Include directories and macros INCDIRS = $(PROJECT_PATH) $(PROJECT_PATH)/gui $(POWERMON_LIB_PATH)/inc INCDIRS += $(PROJECT_PATH)/lib/wxWidgets/lib/$(UBUNTU_RELEASE) $(PROJECT_PATH)/lib/wxWidgets/include CPPDEFS += _FILE_OFFSET_BITS=64 __WXGTK__ wxDEBUG_LEVEL=0 CFLAGS += CXXFLAGS += -Wno-unused-parameter LDFLAGS += -lstdc++ -lbluetooth -lm -ldl LDFLAGS += -lrt -lpthread -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lX11 -lXxf86vm -lSM -lxkbcommon -lXtst -lpangoft2-1.0 -lfontconfig -lfreetype -lpng -lz -ljpeg -ltiff -ljbig -lexpat -lpcre2-32 -lcurl LIBS += $(POWERMON_LIB_PATH)/powermon_lib.a LIBS += $(PROJECT_PATH)/lib/wxWidgets/lib/$(UBUNTU_RELEASE)/libwx_gtk3u-3.2.a include $(PROJECT_PATH)/submodules/build_scripts/config_linux.mk SHORTCUT = $(OUTDIR)/$(TARGET).desktop user_target: $(OUTDIR)/$(TARGET) $(SHORTCUT): @echo "Creating shortcut file ..." @touch $(SHORTCUT) @echo "[Desktop Entry]" > $(SHORTCUT) @echo "Version=$(BUILD_VERSION)" >> $(SHORTCUT) @echo "Type=Application" >> $(SHORTCUT) @echo "Terminal=false" >> $(SHORTCUT) @echo "Exec=/usr/bin/$(TARGET)" >> $(SHORTCUT) @echo "Name=PowerMon Manager $(FQVER)" >> $(SHORTCUT) @echo "Icon=$(TARGET).png" >> $(SHORTCUT) @chmod a+x $(SHORTCUT) deb: $(SHORTCUT) #install the software @$(INSTALL) -m 555 -D bin/$(TARGET) $(DEBDIR)/usr/bin/$(TARGET) @$(INSTALL) -m 555 -D $(SHORTCUT) $(DEBDIR)/usr/share/applications/$(TARGET).desktop @$(INSTALL) -m 444 -D $(PROJECT_PATH)/gui/resources/powermon_icon_512x512.png $(DEBDIR)/usr/share/icons/hicolor/512x512/apps/$(TARGET).png @$(INSTALL) -m 755 -d $(DEBDIR)/DEBIAN #control @$(RM) -rf $(DEBDIR)/DEBIAN/control @$(TOUCH) $(DEBDIR)/DEBIAN/control @$(CHMOD) 644 $(DEBDIR)/DEBIAN/control @$(ECHO) "Source: $(PKGNAME)" >> $(DEBDIR)/DEBIAN/control @$(ECHO) "Section: Science" >> $(DEBDIR)/DEBIAN/control @$(ECHO) "Priority: optional" >> $(DEBDIR)/DEBIAN/control @$(ECHO) "Maintainer: Thornwave Labs Inc. <support@thornwave.com>" >> $(DEBDIR)/DEBIAN/control @$(ECHO) "Version: $(BUILD_VERSION)" >> $(DEBDIR)/DEBIAN/control @$(ECHO) "Architecture: $(ARCH)" >> $(DEBDIR)/DEBIAN/control @$(ECHO) "Package: $(PKGNAME)" >> $(DEBDIR)/DEBIAN/control @$(ECHO) "Description: PowerMon battery monitor manager tool." >> $(DEBDIR)/DEBIAN/control @$(ECHO) "Depends: libc6, libstdc++6, libcairo2, libfontconfig1, libgcc-s1, libgdk-pixbuf-2.0-0 | libgdk-pixbuf2.0-0, libglib2.0-0t64 | libglib2.0-0, libgtk-3-0t64 | libgtk-3-0, libjpeg8, libpango-1.0-0, libpangocairo-1.0-0, libnotify4, libpangoft2-1.0-0, libpng16-16t64 | libpng16-16, libsm6, libx11-6, libxkbcommon0, libxtst6" >> $(DEBDIR)/DEBIAN/control #postinst @$(RM) -rf $(DEBDIR)/DEBIAN/postinst @$(TOUCH) $(DEBDIR)/DEBIAN/postinst @$(CHMOD) 755 $(DEBDIR)/DEBIAN/postinst @$(ECHO) "setcap 'cap_net_raw,cap_net_admin+eip' /usr/bin/$(TARGET)" > $(DEBDIR)/DEBIAN/postinst #changelog @$(RM) -rf $(DEBDIR)/DEBIAN/changelog @$(TOUCH) $(DEBDIR)/DEBIAN/changelog @$(CHMOD) 644 $(DEBDIR)/DEBIAN/changelog @$(ECHO) "$(PKGNAME) ($(BUILD_VERSION)) $(UBUNTU_RELEASE); urgency=high" >> $(DEBDIR)/DEBIAN/changelog @$(ECHO) >> $(DEBDIR)/DEBIAN/changelog @$(ECHO) " * $(PKGNAME) package" >> $(DEBDIR)/DEBIAN/changelog @$(ECHO) >> $(DEBDIR)/DEBIAN/changelog @$(ECHO) " -- Thornwave Labs Inc. <support@thornwave.com> "`date -R` >> $(DEBDIR)/DEBIAN/changelog @$(MKDIR) -p repo/$(UBUNTU_RELEASE) @$(FAKEROOT) $(DPKG) --build $(DEBDIR)/ repo/$(UBUNTU_RELEASE)/$(PKGNAME)_$(BUILD_VERSION)-$(DEB_VERSION)_$(ARCH).deb publish: scp -r repo/* pegasus:~/Pending/apt.thornwave.com user_clean_target: -@$(RM) -rf repo