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
|
*.o
|
||||||
|
*.ro
|
||||||
|
*.do
|
||||||
|
ddish
|
||||||
dish
|
dish
|
40
Makefile
40
Makefile
|
@ -1,22 +1,32 @@
|
||||||
OBJ=main.o line.o loop.o exec.o builtin.o
|
SHELL := /bin/bash
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS= -O3 -Wall
|
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
|
all:release debug
|
||||||
r:release
|
debug: CFLAGS = -g -O0 -DDEBUG
|
||||||
release:dish
|
release: CFLAGS = -Wall -O3
|
||||||
|
|
||||||
dish: $(OBJ)
|
release: $(OBJ)
|
||||||
$(CC) $(CFLAGS) -o dish $(OBJ)
|
$(CC) $(CFLAGS) -o $(EXE) $(OBJ)
|
||||||
|
|
||||||
d:
|
debug: $(DBGOBJ)
|
||||||
make clean
|
$(CC) $(CFLAGS) -o $(DBGEXE) $(DBGOBJ)
|
||||||
make debug
|
|
||||||
|
|
||||||
debug: CFLAGS += -DDEBUG -g
|
clean:
|
||||||
debug: 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
|
c:clean
|
||||||
clean:
|
d:debug
|
||||||
rm -f $(OBJ) dish
|
r:release
|
||||||
|
|
Loading…
Reference in a new issue