forked from NJU-ProjectN/os-workbench-2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (22 loc) · 899 Bytes
/
Makefile
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
export TOKEN := ???
# ----- DO NOT MODIFY -----
ifeq ($(NAME),)
$(error Should make in each lab's directory)
endif
SRCS := $(shell find . -maxdepth 1 -name "*.c")
DEPS := $(shell find . -maxdepth 1 -name "*.h") $(SRCS)
CFLAGS += -O1 -std=gnu11 -ggdb -Wall -Werror -Wno-unused-result -Wno-unused-value -Wno-unused-variable
.PHONY: all git test clean commit-and-make
.DEFAULT_GOAL := commit-and-make
commit-and-make: git all
$(NAME)-64: $(DEPS) # 64bit binary
gcc -m64 $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS)
$(NAME)-32: $(DEPS) # 32bit binary
gcc -m32 $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS)
$(NAME)-64.so: $(DEPS) # 64bit shared library
gcc -fPIC -shared -m64 $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS)
$(NAME)-32.so: $(DEPS) # 32bit shared library
gcc -fPIC -shared -m32 $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS)
clean:
rm -f $(NAME)-64 $(NAME)-32 $(NAME)-64.so $(NAME)-32.so
include ../Makefile.lab