build: improve build efficiency
This commit is contained in:
parent
4a018bad5d
commit
72b7a424b7
2 changed files with 29 additions and 16 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,5 @@
|
|||
*.o
|
||||
*.ro
|
||||
*.do
|
||||
ddish
|
||||
dish
|
42
Makefile
42
Makefile
|
@ -1,22 +1,32 @@
|
|||
OBJ=main.o line.o loop.o exec.o builtin.o
|
||||
CC=gcc
|
||||
CFLAGS= -O3 -Wall
|
||||
SHELL := /bin/bash
|
||||
CC = gcc
|
||||
SRC = main.c loop.c exec.c line.c builtin.c
|
||||
OBJ = $(SRC:.c=.ro)
|
||||
DBGOBJ = $(SRC:.c=.do)
|
||||
EXE = dish
|
||||
DBGEXE = ddish
|
||||
|
||||
all:release
|
||||
r:release
|
||||
release:dish
|
||||
all:release debug
|
||||
debug: CFLAGS = -g -O0 -DDEBUG
|
||||
release: CFLAGS = -Wall -O3
|
||||
|
||||
dish: $(OBJ)
|
||||
$(CC) $(CFLAGS) -o dish $(OBJ)
|
||||
release: $(OBJ)
|
||||
$(CC) $(CFLAGS) -o $(EXE) $(OBJ)
|
||||
|
||||
d:
|
||||
make clean
|
||||
make debug
|
||||
debug: $(DBGOBJ)
|
||||
$(CC) $(CFLAGS) -o $(DBGEXE) $(DBGOBJ)
|
||||
|
||||
debug: CFLAGS += -DDEBUG -g
|
||||
debug: dish
|
||||
|
||||
c: clean
|
||||
clean:
|
||||
rm -f $(OBJ) dish
|
||||
rm -f *.o
|
||||
|
||||
$(OBJ):$(SRC)
|
||||
$(CC) $(CFLAGS) -c $(SRC)
|
||||
rename .o .ro *.o
|
||||
|
||||
$(DBGOBJ):$(SRC)
|
||||
$(CC) $(CFLAGS) -c $(SRC)
|
||||
rename .o .do *.o
|
||||
|
||||
c:clean
|
||||
d:debug
|
||||
r:release
|
Loading…
Reference in a new issue