Skip to content

Commit 1d4e21d

Browse files
committed
Fix Makefile to not compile the same code 3 times
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.
1 parent a080f17 commit 1d4e21d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ BINDIR=${DESTDIR}${PREFIX}/bin
1515
all: nsm
1616

1717
nsm: $(objects)
18-
$(CXX) $(CXXFLAGS) $(cppfiles) -o nsm $(LINK)
19-
$(CXX) $(CXXFLAGS) $(cppfiles) -o nift $(LINK)
18+
$(CXX) $(CXXFLAGS) $(objects) -o nsm $(LINK)
2019

2120
nsm.o: nsm.cpp GitInfo.o SiteInfo.o Timer.h
2221
$(CXX) $(CXXFLAGS) -c -o $@ $< $(LINK)
@@ -61,26 +60,26 @@ linux-gedit-highlighting:
6160
install:
6261
mkdir -p ${BINDIR}
6362
chmod 755 nsm
64-
mv nift ${BINDIR}
6563
mv nsm ${BINDIR}
64+
ln ${BINDIR}/nsm ${BINDIR}/nift
6665

6766
uninstall:
6867
rm ${BINDIR}/nift
6968
rm ${BINDIR}/nsm
7069

7170
git-bash-install:
7271
chmod 755 nsm
73-
mv nift ~/bin
7472
mv nsm ~/bin
73+
ln ~/bin/nsm ~/bin/nift
7574

7675
git-bash-uninstall:
7776
rm ~/bin/nift
7877
rm ~/bin/nsm
7978

8079
gitbash-install:
8180
chmod 755 nsm
82-
mv nift ~/bin
8381
mv nsm ~/bin
82+
ln ~/bin/nsm ~/bin/nift
8483

8584
gitbash-uninstall:
8685
rm ~/bin/nift

0 commit comments

Comments
 (0)