git @ Cat's Eye Technologies linapple / 8835ea6
Make make install/uninstall work Cleaned up make install which didn't work, and recreated make uninstall which didn't exist. This undoes some of Greg's dir/* magic processing in terms of assets at least. That's probably okay though because that kind of magic processing usually winds up breaking in some way, be it major or minor. For example we shouldn't be installing font.xcf. Things in res/ which _should_ be installed are listed in INSTASSETS now, no subdir needed. That'll do for now. The things presently in this list will eventually be installed somewhere in $PREFIX/share, which is why linapple.conf isn't here. CONFFILES are also currently found in res/ and are just linapple.conf for now. These files all still get copied to bin on make, but the versions in bin are not the ones that get installed. That whole TARGETDIR thing is part of Greg's package building. I'm sort of planning to move this tree to autoconf possibly and automake, on the assumption that a headache now porting it will give us a lot of portability later to BSD, Mac, and even Windows if built under MSYS2. (Although builds under Windows probably are going to want to use Visual Studio, and someone's gonna want XCode on the mac… These aren't my problem.) Haven't touched make package yet. T. Joseph Carter 3 years ago
1 changed file(s) with 78 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
0 #! /usr/bin/make -f
1
2 PACKAGE := linapple
3 VERSION := 2.1.1
4
5 # Where does this get installed
6 PREFIX := /usr/local
7
08 #Compiler and Linker
19 CC := g++
210
1321 DEPEXT := d
1422 OBJEXT := o
1523
16 VERSION := 2.1.1
17 PKG := linapple
18
19 INSTDIR = /usr/local/bin/$(EXE)
20 CONFDIR = ~/$(TARGET)
24 INSTDIR := $(PREFIX)/lib/$(PACKAGE)
2125
2226 #Flags, Libraries and Includes
2327
4852 #---------------------------------------------------------------------------------
4953 SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
5054 OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
55 INSTASSETS := \
56 charset40.bmp \
57 font.bmp \
58 icon.bmp \
59 splash.bmp \
60 Master.dsk
61 CONFFILES := \
62 linapple.conf
5163
5264 #Default Make
5365 all: resources $(TARGETDIR)/$(TARGET)
5769
5870 #Copy Resources from Resources Directory to Target Directory
5971 resources: directories
60 @cp $(RESDIR)/* $(TARGETDIR)/
72 @cp $(RESDIR)/* $(TARGETDIR)/
6173
6274 #Make the Directories
6375 directories:
64 @mkdir -p $(TARGETDIR)
65 @mkdir -p $(BUILDDIR)
76 @mkdir -p $(TARGETDIR)
77 @mkdir -p $(BUILDDIR)
6678
6779 package: all
6880 @echo " Building a package"
69 mkdir -p "pkg/$(PKG)/$(PKG)-$(VERSION)/etc/$(PKG)"
70 mkdir -p "pkg/$(PKG)/$(PKG)-$(VERSION)/usr/bin/"
71 @cp -rf $(RESDIR)/* "pkg/$(PKG)/$(PKG)-$(VERSION)/etc/$(PKG)"
72 @cp $(TARGETDIR)/$(TARGET) "pkg/$(PKG)/$(PKG)-$(VERSION)/usr/bin/$(TARGET)"
73 chown -R root:root "pkg/$(PKG)"
74 dpkg --build "pkg/$(PKG)/$(PKG)-$(VERSION)"
75 mv "pkg/$(PKG)/$(PKG)-$(VERSION).deb" .
81 mkdir -p "pkg/$(PACKAGE)/$(PACKAGE)-$(VERSION)/etc/$(PACKAGE)"
82 mkdir -p "pkg/$(PACKAGE)/$(PACKAGE)-$(VERSION)/usr/bin/"
83 @cp -rf $(RESDIR)/* "pkg/$(PACKAGE)/$(PACKAGE)-$(VERSION)/etc/$(PACKAGE)"
84 @cp $(TARGETDIR)/$(TARGET) "pkg/$(PACKAGE)/$(PACKAGE)-$(VERSION)/usr/bin/$(TARGET)"
85 chown -R root:root "pkg/$(PACKAGE)"
86 dpkg --build "pkg/$(PACKAGE)/$(PACKAGE)-$(VERSION)"
87 mv "pkg/$(PACKAGE)/$(PACKAGE)-$(VERSION).deb" .
7688
7789 install: all
78 @echo " o Creating install directory '$(INSTDIR)'"
79 mkdir -p "$(INSTDIR)"
80 chmod 777 "$(INSTDIR)"
81 @echo " o Creating additional directories 'conf' and 'ftp' in '$(INSTDIR)'"
82 mkdir "$(CONFDIR)/conf"
83 mkdir -p "$(CONFDIR)/sound"
90 @echo "`tput bold`o Creating '$(INSTDIR)'`tput sgr0`"
91 # Windows-style all-in-one dir. Let's get rid of this at some point
92 install -d -m 755 -o root -g root "$(INSTDIR)"
93
94 @echo
95 @echo "`tput bold`o Copying binary to install directory '$(INSTDIR)'`tput sgr0`"
96 # This should be able to live in $(PREFIX)/bin directly, symlink for now
97 install -m 755 -o root -g root "$(TARGETDIR)/$(TARGET)" "$(INSTDIR)"
98 # We'll use a symlink until then
99 if [ -L "$(PREFIX)/bin/$(TARGET)" ]; then \
100 rm -f "$(PREFIX)/bin/$(TARGET)" ;\
101 fi
102 ln -s $(INSTDIR)/$(TARGET) $(PREFIX)/bin/$(TARGET)
103
104 @echo
105 @echo "`tput bold`o Copying assets to install directory '$(INSTDIR)'`tput sgr0`"
106 # These properly belong in $(PREFIX)/share…
107 for file in $(INSTASSETS); do \
108 install -m 644 -o root -g root "$(RESDIR)/$$file" "$(INSTDIR)" ;\
109 done
110
111 @echo
112 @echo "`tput bold`o Copying docs to install directory '$(INSTDIR)'`tput sgr0`"
113 # This belongs in $(PREFIX)/etc or /etc
114 for file in $(CONFFILES); do \
115 install -m 644 -o root -g root "$(RESDIR)/$$file" "$(INSTDIR)" ;\
116 done
117
118 uninstall:
119 @echo "`tput bold`o Uninstalling $(TARGET) from '$(INSTDIR)'`tput sgr0`"
120 # We could possibly just rm -rf this, but that's kind of a no-no
121 for file in $(TARGET) $(INSTASSETS) $(CONFFILES); do \
122 rm -f "$(INSTDIR)/$$file" ;\
123 done
124 # It's okay if this fails (examine $(INSTDIR) yourself)
125 rmdir $(INSTDIR) 2>/dev/null || true
126 # Don't forget the linapple symlink in $(PREFIX)/bin
127 rm -f "$(PREFIX)/bin/$(TARGET)"
128
84129
85130 #Clean only Objects
86131 clean:
87 @$(RM) -rf $(BUILDDIR)
88 @$(RM) -rf $(TARGETDIR)
132 @$(RM) -rf $(BUILDDIR)
133 @$(RM) -rf $(TARGETDIR)
89134
90135 #Full Clean, Objects and Binaries
91136 cleaner: clean
92 @$(RM) -rf $(TARGETDIR)
93 @$(RM) $(TARGET)-$(VERSION).deb
137 @$(RM) -rf $(TARGETDIR)
138 @$(RM) $(TARGET)-$(VERSION).deb
94139
95140 #Pull in dependency info for *existing* .o files
96141 -include $(OBJECTS:.$(OBJEXT)=.$(DEPEXT))
98143 #Link
99144
100145 $(TARGETDIR)/$(TARGET): $(OBJECTS)
101 $(CC) $(LFLAGS) -o $(TARGETDIR)/$(TARGET) $^ $(LIB)
146 $(CC) $(LFLAGS) -o $(TARGETDIR)/$(TARGET) $^ $(LIB)
102147
103148 #Compile
104149 $(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
105 @mkdir -p $(dir $@)
106 $(CC) $(CFLAGS) $(INC) -c -o $@ $<
107 @$(CC) $(CFLAGS) $(INCDEP) -MM $(SRCDIR)/$*.$(SRCEXT) > $(BUILDDIR)/$*.$(DEPEXT)
108 @cp -f $(BUILDDIR)/$*.$(DEPEXT) $(BUILDDIR)/$*.$(DEPEXT).tmp
109 @sed -e 's|.*:|$(BUILDDIR)/$*.$(OBJEXT):|' < $(BUILDDIR)/$*.$(DEPEXT).tmp > $(BUILDDIR)/$*.$(DEPEXT)
110 @sed -e 's/.*://' -e 's/\\$$//' < $(BUILDDIR)/$*.$(DEPEXT).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(BUILDDIR)/$*.$(DEPEXT)
111 @rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
150 @mkdir -p $(dir $@)
151 $(CC) $(CFLAGS) $(INC) -c -o $@ $<
152 @$(CC) $(CFLAGS) $(INCDEP) -MM $(SRCDIR)/$*.$(SRCEXT) > $(BUILDDIR)/$*.$(DEPEXT)
153 @cp -f $(BUILDDIR)/$*.$(DEPEXT) $(BUILDDIR)/$*.$(DEPEXT).tmp
154 @sed -e 's|.*:|$(BUILDDIR)/$*.$(OBJEXT):|' < $(BUILDDIR)/$*.$(DEPEXT).tmp > $(BUILDDIR)/$*.$(DEPEXT)
155 @sed -e 's/.*://' -e 's/\\$$//' < $(BUILDDIR)/$*.$(DEPEXT).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(BUILDDIR)/$*.$(DEPEXT)
156 @rm -f $(BUILDDIR)/$*.$(DEPEXT).tmp
112157
113158 #Non-File Targets
114159 .PHONY: all remake clean cleaner resources