Skip to content
This repository
Browse code

Makefile iprovements. * define SHELL and INSTALL* variables * allow u…

…sers to specify CFLAGS freely

Signed-off-by: Michał Siejak <michal@siejak.pl>
  • Loading branch information...
commit 554f8c7dee381da33bee7a187d3d8d0a4d75abb5 1 parent 425ced4
authored October 15, 2011 Nadrin committed October 15, 2011

Showing 1 changed file with 23 additions and 11 deletions. Show diff stats Hide diff stats

  1. 34  Makefile
34  Makefile
@@ -14,7 +14,18 @@ sysconfdir = $(prefix)/etc
14 14
 sharedstatedir = $(prefix)/com
15 15
 localstatedir = $(prefix)/var
16 16
 
17  
-CFLAGS += -I./include -g -Wall
  17
+SHELL = /bin/sh
  18
+INSTALL = /usr/bin/install
  19
+INSTALL_DIR = $(INSTALL) -d
  20
+INSTALL_DATA = $(INSTALL) -m 644
  21
+INSTALL_PROGRAM = $(INSTALL)
  22
+INSTALL_PROGRAM_STRIP = $(INSTALL) -s
  23
+
  24
+CFLAGS += -g -Wall
  25
+ALL_CFLAGS = -I./include $(CFLAGS)
  26
+
  27
+.SUFFIXES:
  28
+.SUFFIXES: .o
18 29
 
19 30
 vpath %.c ./src
20 31
 
@@ -36,20 +47,19 @@ xlsh: $(XLSH_OBJ) $(XLSH_LIBS)
36 47
 xlshd: $(XLSHD_OBJ)
37 48
 
38 49
 install: installdirs
39  
-	install -m 755 xlsh $(DESTDIR)$(sbindir)
40  
-	install -m 755 xlshd $(DESTDIR)$(sbindir)
41  
-	install -d -m 755 $(DESTDIR)$(sysconfdir)/xlsh
42  
-	install -m 644 etc/xlshrc $(DESTDIR)$(sysconfdir)/xlsh
43  
-	install -m 644 etc/Xresources $(DESTDIR)$(sysconfdir)/xlsh
  50
+	$(INSTALL_PROGRAM) xlsh $(DESTDIR)$(sbindir)
  51
+	$(INSTALL_PROGRAM) xlshd $(DESTDIR)$(sbindir)
  52
+	$(INSTALL_DATA) etc/xlshrc $(DESTDIR)$(sysconfdir)/xlsh
  53
+	$(INSTALL_DATA) etc/Xresources $(DESTDIR)$(sysconfdir)/xlsh
44 54
 
45 55
 install-strip: installdirs
46  
-	install -s -m 755 xlsh $(DESTDIR)$(sbindir)
47  
-	install -s -m 755 xlshd $(DESTDIR)$(sbindir)
48  
-	install -m 644 etc/xlshrc $(DESTDIR)$(sysconfdir)/xlsh
49  
-	install -m 644 etc/Xresources $(DESTDIR)$(sysconfdir)/xlsh
  56
+	$(INSTALL_PROGRAM_STRIP) xlsh $(DESTDIR)$(sbindir)
  57
+	$(INSTALL_PROGRAM_STRIP) xlshd $(DESTDIR)$(sbindir)
  58
+	$(INSTALL_DATA) etc/xlshrc $(DESTDIR)$(sysconfdir)/xlsh
  59
+	$(INSTALL_DATA) etc/Xresources $(DESTDIR)$(sysconfdir)/xlsh
50 60
 
51 61
 installdirs:
52  
-	install -d $(DESTDIR)$(sbindir) $(DESTDIR)$(sysconfdir)/xlsh
  62
+	$(INSTALL_DIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(sysconfdir)/xlsh
53 63
 
54 64
 uninstall:
55 65
 	rm -f ${DESTDIR}$(sbindir)/xlsh
@@ -59,3 +69,5 @@ clean:
59 69
 	rm -f $(PROGRAMS)
60 70
 	rm -f $(XLSH_OBJ) $(XLSHD_OBJ)
61 71
 
  72
+%.o: %.c
  73
+	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -o $@

0 notes on commit 554f8c7

Please sign in to comment.
Something went wrong with that request. Please try again.