forked from tronkko/dirent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.linux
69 lines (58 loc) · 1.86 KB
/
Makefile.linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This Makefile will pack dirent into a distributable zip
# package. To build the package, invoke this Makefile as
#
# make -f Makefile.linux dist
#
# Current cersion number
VERSION=1.22
# List of files to include in zip package
DIST_FILES = include/*.h examples/*.c tests/*.c tests/1/file tests/1/dir/* tests/2/* CMakeLists.txt ChangeLog README.md
# Default target
all: ls find
# Build Linux versions of example programs
ls: examples/ls.c
gcc -W -Wall -o ls examples/ls.c
find: examples/find.c
gcc -W -Wall -o find examples/find.c
# Run regression tests
check: t-dirent
./t-dirent
t-dirent: tests/t-dirent.c
gcc -W -Wall -o t-dirent tests/t-dirent.c
# Show usage
help:
@echo "Build targets available:"
@echo " clean Remove temporary files"
@echo " dist Build distributable package"
@echo " check Run regression tests"
# Wipe out temporary files left behind by MS-Visual Studio and CMake
clean:
rm -f ls find t-dirent t-compile locate updatedb
rm -fr Debug Release Testing
rm -fr *.dir
rm -f *.vcproj *.user
rm -fr CMakeFiles
rm -f CMakeCache.txt CTestTestfile.cmake cmake_install.cmake
rm -f dirent.ncb dirent.sln dirent.suo
rm -f DartConfiguration.tcl locate.db Makefile
rm -fr dirent-$(VERSION)
rm -f dirent-*.zip
# Build installation package
dist: dirent-$(VERSION).zip
dirent-$(VERSION).zip: $(DIST_FILES)
rm -f dirent-$(VERSION).zip
rm -fr dirent-$(VERSION)
mkdir dirent-$(VERSION)
for f in $(DIST_FILES); do \
dir=`echo "$$f" | sed -e 's:^[^/]*$$::' -e 's://*[^/]*$$::' -e 's:^$$:.:'`; \
if [ -d "dirent-$(VERSION)/$$dir" ]; then \
:; \
else \
mkdir "dirent-$(VERSION)/$$dir"; \
chmod 0755 "dirent-$(VERSION)/$$dir"; \
fi; \
cp "$$f" "dirent-$(VERSION)/$$dir/"; \
chmod 0644 "dirent-$(VERSION)/$$f"; \
done
( cd dirent-$(VERSION) && zip -r ../dirent-$(VERSION).zip . )
rm -fr dirent-$(VERSION)