Skip to content

Commit

Permalink
Fix Makefile to not compile the same code 3 times
Browse files Browse the repository at this point in the history
Currently, nift code is compiled 3 times:
- When building object files
- When building nift binary (object files are not used as sources are passed to the linker)
- When building nsm binary

So pass object files to the linker and only call it once, then
create hardlink on installation.
  • Loading branch information
AMDmi3 committed Dec 10, 2019
1 parent a080f17 commit 1d4e21d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ BINDIR=${DESTDIR}${PREFIX}/bin
all: nsm

nsm: $(objects)
$(CXX) $(CXXFLAGS) $(cppfiles) -o nsm $(LINK)
$(CXX) $(CXXFLAGS) $(cppfiles) -o nift $(LINK)
$(CXX) $(CXXFLAGS) $(objects) -o nsm $(LINK)

nsm.o: nsm.cpp GitInfo.o SiteInfo.o Timer.h
$(CXX) $(CXXFLAGS) -c -o $@ $< $(LINK)
Expand Down Expand Up @@ -61,26 +60,26 @@ linux-gedit-highlighting:
install:
mkdir -p ${BINDIR}
chmod 755 nsm
mv nift ${BINDIR}
mv nsm ${BINDIR}
ln ${BINDIR}/nsm ${BINDIR}/nift

uninstall:
rm ${BINDIR}/nift
rm ${BINDIR}/nsm

git-bash-install:
chmod 755 nsm
mv nift ~/bin
mv nsm ~/bin
ln ~/bin/nsm ~/bin/nift

git-bash-uninstall:
rm ~/bin/nift
rm ~/bin/nsm

gitbash-install:
chmod 755 nsm
mv nift ~/bin
mv nsm ~/bin
ln ~/bin/nsm ~/bin/nift

gitbash-uninstall:
rm ~/bin/nift
Expand Down

0 comments on commit 1d4e21d

Please sign in to comment.