Skip to content

Commit

Permalink
更新构建代码
Browse files Browse the repository at this point in the history
  • Loading branch information
lmliheng committed Jun 18, 2024
1 parent 33bc893 commit f0cbdf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: 编译
run: make
run: gcc -I./includes -Wall -c src/bootstrap.c src/Utils/cmd_utils.c src/Utils/install_utils.c src/Utils/shell_utils.c src/LoginShell/ExamAll.c src/FileManagement/FileInfo.c src/Utils/updata_utils.c src/Utils/Version.c src/Library/PrintColor.c -o objs/bootstrap.o objs/cmd_utils.o objs/install_utils.o objs/shell_utils.o objs/ExamAll.o objs/FileInfo.o objs/updata_utils.o objs/Version.o objs/PrintColor.o && cd lib && ar rcs libprintcolor.a ../objs/PrintColor.o && gcc objs/bootstrap.o objs/cmd_utils.o objs/install_utils.o objs/shell_utils.o objs/ExamAll.o objs/FileInfo.o objs/updata_utils.o objs/Version.o -o cil -L./lib -lprintcolor
21 changes: 5 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CC = gcc
CFLAGS = -I./includes -Wall
OBJFILES = objs/bootstrap.o objs/cmd_utils.o objs/install_utils.o objs/shell_utils.o objs/ExamAll.o objs/FileInfo.o objs/updata_utils.o objs/Version.o
CFLAGS = -I./includes -Wall -fPIC
OBJFILES = objs/bootstrap.o objs/cmd_utils.o objs/install_utils.o objs/shell_utils.o objs/ExamAll.o objs/FileInfo.o objs/updata_utils.o objs/Version.o
TARGET = cil
LIBTARGET = lib/libprintcolor.a
LIBOBJS = objs/PrintColor.o
Expand All @@ -10,18 +10,13 @@ all: $(TARGET)
objs:
@mkdir -p objs



objs/PrintColor.o: src/Library/PrintColor.c objs
$(CC) $(CFLAGS) -c $< -o $@

$(LIBTARGET): $(LIBOBJS)
@mkdir -p lib
@mkdir -p lib
cd lib && $(AR) rcs $(notdir $(LIBTARGET)) ../$(LIBOBJS)




objs/bootstrap.o: src/bootstrap.c objs
$(CC) $(CFLAGS) -c $< -o $@

Expand All @@ -44,16 +39,10 @@ objs/updata_utils.o: src/Utils/updata_utils.c objs
$(CC) $(CFLAGS) -c $< -o $@

objs/Version.o: src/Utils/Version.c objs
$(CC) $(CFLAGS) -c $< -o $@



$(CC) $(CFLAGS) -c $< -o $@

$(TARGET): $(OBJFILES) $(LIBTARGET)
$(CC) $(OBJFILES) -o $(TARGET) -L./lib -lprintcolor



$(CC) $(CFLAGS) -pie $(OBJFILES) -o $(TARGET) -L./lib -lprintcolor

clean:
rm -f $(OBJFILES) $(TARGET) $(LIBTARGET)

0 comments on commit f0cbdf4

Please sign in to comment.