├── .gitignore ├── Makefile.lab └── Makefile /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.[oad] 3 | !.gitignore 4 | *~ 5 | a.out 6 | a.out-* 7 | *-32* 8 | *-64* 9 | -------------------------------------------------------------------------------- /Makefile.lab: -------------------------------------------------------------------------------- 1 | # **DO NOT MODIFY** 2 | 3 | export COURSE := OS2021 4 | URL := 'http://jyywiki.cn' 5 | 6 | submit: 7 | @cd $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) && \ 8 | curl -sSL '$(URL)/static/submit.sh' | bash 9 | 10 | git: 11 | @git add $(shell find . -name "*.c") $(shell find . -name "*.h") -A --ignore-errors 12 | @while (test -e .git/index.lock); do sleep 0.1; done 13 | @(hostnamectl && uptime) | git commit -F - -q --author='tracer-nju ' --no-verify --allow-empty 14 | @sync 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # **DO NOT MODIFY** 2 | 3 | ifeq ($(NAME),) 4 | $(error Should make in each lab's directory) 5 | endif 6 | 7 | SRCS := $(shell find . -maxdepth 1 -name "*.c") 8 | DEPS := $(shell find . -maxdepth 1 -name "*.h") $(SRCS) 9 | CFLAGS += -O1 -std=gnu11 -ggdb -Wall -Werror -Wno-unused-result -Wno-unused-value -Wno-unused-variable 10 | 11 | .PHONY: all git test clean commit-and-make 12 | 13 | .DEFAULT_GOAL := commit-and-make 14 | commit-and-make: git all 15 | 16 | $(NAME)-64: $(DEPS) # 64bit binary 17 | gcc -m64 $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) 18 | 19 | $(NAME)-32: $(DEPS) # 32bit binary 20 | gcc -m32 $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) 21 | 22 | $(NAME)-64.so: $(DEPS) # 64bit shared library 23 | gcc -fPIC -shared -m64 $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) 24 | 25 | $(NAME)-32.so: $(DEPS) # 32bit shared library 26 | gcc -fPIC -shared -m32 $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) 27 | 28 | clean: 29 | rm -f $(NAME)-64 $(NAME)-32 $(NAME)-64.so $(NAME)-32.so 30 | 31 | include ../Makefile.lab 32 | --------------------------------------------------------------------------------