1 SHELL=/bin/sh
2 PREFIX=/usr
3 #
4 # Makefile for XNEdit text editor
5 #
6 # Targets are the suffixes of the system-specific makefiles in
7 # the makefiles/ directory.
8 # For example, to build XNEdit for Solaris, give the command
9 #
10 # make solaris
11 #
12 # This builds an intermediate library in the util/ directory,
13 # then builds the xnedit and xnc executables in the source/ directory.
14 #
15
16 OS=$(shell uname -o)
17
18 all:
19 @echo "Please specify target:"
20 @echo "(For example, type \"make linux\" for a Linux system.)"
21 @(cd makefiles && ls -C Makefile* | sed -e 's/Makefile.//g')
22
23 .DEFAULT:
24 @- (cd Microline/XmL; if [ -f ../../makefiles/Makefile.$@ -a ! -f ./Makefile.$@ ];\
25 then ln -s ../../makefiles/Makefile.$@ .; fi)
26 @- (cd Xlt; if [ -f ../makefiles/Makefile.$@ -a ! -f ./Makefile.$@ ];\
27 then ln -s ../makefiles/Makefile.$@ .; fi)
28 @- (cd util; if [ -f ../makefiles/Makefile.$@ -a ! -f ./Makefile.$@ ];\
29 then ln -s ../makefiles/Makefile.$@ .; fi)
30 @- (cd source; if [ -f ../makefiles/Makefile.$@ -a ! -f ./Makefile.$@ ];\
31 then ln -s ../makefiles/Makefile.$@ .; fi)
32
33 (cd util; \
34 $(MAKE) -f Makefile.$@ libNUtil.a)
35 (cd Xlt; $(MAKE) -f Makefile.$@ libXlt.a)
36 (cd Microline/XmL; $(MAKE) -f Makefile.$@ libXmL.a)
37 (cd source; $(MAKE) -f Makefile.$@ xnedit xnc)
38 @source/xnedit -V
39
40 # This should not be in the default build, as users may not have Perl
41 # installed. This is only interesting to developers.
42 docs:
43 (cd doc; $(MAKE) all)
44
45 # We need a "dev-all" target that builds the docs plus binaries, but
46 # that doesn't work since we require the user to specify the target. More
47 # thought is needed
48
49 clean:
50 (cd util; $(MAKE) -f Makefile.common clean)
51 (cd Xlt; $(MAKE) -f Makefile.common clean)
52 (cd Microline/XmL; $(MAKE) -f Makefile.common clean)
53 (cd source; $(MAKE) -f Makefile.common clean)
54
55 realclean: clean
56 (cd doc; $(MAKE) clean)
57 #
58 # install binaries and other resources to $(PREFIX)
59 #
60 INSTALL_FILES=source/xnedit source/xnc
61 install: $(INSTALL_FILES)
62 mkdir -p $(DESTDIR)$(PREFIX)/bin
63 mkdir -p $(DESTDIR)$(PREFIX)/share/icons
64 mkdir -p $(DESTDIR)$(PREFIX)/share/applications
65 rm -f $(DESTDIR)$(PREFIX)/bin/xnedit
66 rm -f $(DESTDIR)$(PREFIX)/bin/xnc
67 cp source/xnedit $(DESTDIR)$(PREFIX)/bin/xnedit
68 cp source/xnc $(DESTDIR)$(PREFIX)/bin/xnc
69 cp resources/desktop/xnedit.png $(DESTDIR)$(PREFIX)/share/icons/xnedit.png
70 sed s:%PREFIX%:$(PREFIX):g resources/desktop/xnedit.desktop.template > $(DESTDIR)$(PREFIX)/share/applications/xnedit.desktop
71
72
73 # On Cygwin, you can customize 'bin' and 'pkg' than run 'xneditPkg.sh'
74 cygwin-install: $(INSTALL_FILES)
75 @echo "Cygwin: You can change installation path in 'resources/cygwin/xneditPkg.sh:pkg'"
76 @read -p "ENTER to continue"
77 @cd resources/cygwin; ./xneditPkg.sh
78
79 #
80 # The following is for creating binary packages of NEdit.
81 #
82 RELEASE=xnedit-1.0-`uname -s`-`uname -m`
83 BINDIST-FILES=source/xnedit source/xnc README LICENSE ReleaseNotes doc/xnedit.txt doc/xnedit.html doc/xnedit.man doc/xnc.man doc/faq.txt resources/desktop/xnedit.desktop resources/desktop/xnedit.png
84
85 dist-bin: $(BINDIST-FILES)
86 rm -rf $(RELEASE)
87 mkdir -p $(RELEASE)
88 cp $(BINDIST-FILES) $(RELEASE)/
89 strip $(RELEASE)/xnedit $(RELEASE)/xnc
90 chmod 555 $(RELEASE)/xnedit $(RELEASE)/xnc
91 tar cf $(RELEASE).tar $(RELEASE)
92 -gzip -9 -c $(RELEASE).tar > $(RELEASE).tar.gz
93 -bzip2 -9 -c $(RELEASE).tar > $(RELEASE).tar.bz2
94 rm -rf $(RELEASE) $(RELEASE).tar
95