-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (43 loc) · 976 Bytes
/
Makefile
File metadata and controls
51 lines (43 loc) · 976 Bytes
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
CC = cc
CFLAGS =
LDFLAGS =
SRCS =
OBJS =
# Default target
default: detect
# OS detection and conditional build
detect:
@OS=`uname -s`; \
if [ "$$OS" = "Linux" ]; then \
echo "*** Compiling for Linux"; \
$(MAKE) bstoolbox \
BUILD_OS=LINUX \
SRCS="bstoolbox.c linux.c" \
OBJS="bstoolbox.o linux.o" \
CFLAGS="-O2 -DOS_LINUX" \
LDFLAGS=""; \
elif [ "$$OS" = "IRIX64" ]; then \
echo "*** Compiling for IRIX64"; \
$(MAKE) bstoolbox \
BUILD_OS=IRIX \
SRCS="bstoolbox.c irix.c" \
OBJS="bstoolbox.o irix.o" \
CFLAGS="-mips3 -n32 -O2 -DOS_IRIX" \
LDFLAGS=""; \
else \
echo "Unsupported OS: $$OS"; exit 1; \
fi
# Build target
bstoolbox: $(OBJS)
$(CC) $(CFLAGS) -o bstoolbox $(OBJS) $(LDFLAGS)
# Object file rules
bstoolbox.o: bstoolbox.c
$(CC) $(CFLAGS) -c bstoolbox.c
irix.o: irix.c
$(CC) $(CFLAGS) -c irix.c
linux.o: linux.c
$(CC) $(CFLAGS) -c linux.c
# Clean rule
clean:
@echo "*** Cleaning up..."
@-rm -f *.o bstoolbox core