| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
#DH_VERBOSE = 1 |
| 4 |
|
| 5 |
VERSION = NEdit released by Debian ($(shell head -1 debian/changelog | sed 's/.*(\(.*\)).*/\1/')) |
| 6 |
|
| 7 |
export DEB_BUILD_MAINT_OPTIONS=hardening=+all |
| 8 |
export DEB_CFLAGS_MAINT_APPEND = -std=gnu17 |
| 9 |
|
| 10 |
LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) |
| 11 |
|
| 12 |
CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) |
| 13 |
|
| 14 |
# For the flags see makefiles/Makefile.generic |
| 15 |
CFLAGS = -DBUILD_UNTESTED_NEDIT -DHAVE__XMVERSIONSTRING \ |
| 16 |
-Wall $(shell dpkg-buildflags --get CFLAGS) |
| 17 |
|
| 18 |
# See http://wiki.debian.org/HardeningWalkthrough#Handwritten_Makefiles |
| 19 |
CFLAGS += $(CPPFLAGS) $(LDFLAGS) |
| 20 |
|
| 21 |
# ----------------------------------------------------------------------- |
| 22 |
|
| 23 |
# Modified during build. Keep original files intact. |
| 24 |
ORIG = source/help_data.h source/help_topic.h |
| 25 |
|
| 26 |
define save |
| 27 |
# Save original files |
| 28 |
for f in $(ORIG); do [ -f $$f._ ] || cp -a $$f $$f._ ; done |
| 29 |
endef |
| 30 |
|
| 31 |
define restore |
| 32 |
# Restore original files |
| 33 |
for f in $(ORIG); do [ ! -f $$f._ ] || mv $$f._ $$f; done |
| 34 |
endef |
| 35 |
|
| 36 |
# ----------------------------------------------------------------------- |
| 37 |
|
| 38 |
override_dh_auto_build: |
| 39 |
$(save) |
| 40 |
sed -i s'/\(NEditVersion = "\).*"/\1$(VERSION)\\n"/' source/help_data.h |
| 41 |
|
| 42 |
$(MAKE) CFLAGS="$(CFLAGS)" linux |
| 43 |
$(MAKE) -C doc VERSION="$(VERSION)" all |
| 44 |
|
| 45 |
mv doc/nc.man doc/nedit-nc.1 |
| 46 |
mv doc/nedit.man doc/nedit.1 |
| 47 |
mv source/nc source/nedit-nc |
| 48 |
$(restore) |
| 49 |
|
| 50 |
override_dh_auto_clean: |
| 51 |
# Generated files |
| 52 |
rm -f doc/nedit.1 doc/nedit-nc.1 source/nedit-nc |
| 53 |
|
| 54 |
$(MAKE) -C doc clean |
| 55 |
$(MAKE) clean |
| 56 |
|
| 57 |
find util source Xlt Microline/XmL -type l | \ |
| 58 |
xargs --no-run-if-empty rm -f |
| 59 |
|
| 60 |
$(restore) |
| 61 |
|
| 62 |
override_dh_auto_test: |
| 63 |
# Nothing to do, but nedit's Makefile processes wrongly if asked |
| 64 |
|
| 65 |
override_dh_auto_install: |
| 66 |
# Nothing to do, but nedit's Makefile processes wrongly if asked |
| 67 |
|
| 68 |
%: |
| 69 |
dh $@ |
| 70 |
|
| 71 |
# End of file |