Skip to content

Commit a8ab7bd

Browse files
committed
Updated Makefile
1 parent 1716d97 commit a8ab7bd

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

Makefile

+20-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
IDIR =include
1+
INCDIR =./include
22
CC=gcc
3-
CFLAGS=-I$(IDIR)
3+
LD=gcc
4+
INCFLAGS=-I$(INCDIR)
5+
CFLAGS=-std=gnu99
46

5-
CDIR=src
6-
BDIR=bin
7-
LDIR =lib
7+
SRCDIR=./src
8+
OBJDIR=./obj
9+
BINDIR=./bin
10+
LIBDIR =./lib
811

912
LIBS=-lreadLine
1013

11-
DEPS = $(wildcard $(IDIR)/*.h)
14+
SRCS = $(wildcard $(SRCDIR)/*.c)
15+
OBJLIST = $(SRCS:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
16+
SRCLIST=
1217

13-
SRC = $(wildcard $(CDIR)/*.c)
18+
$(BINDIR)/wish: $(OBJLIST)
19+
mkdir -p $(BINDIR)
20+
$(LD) -g $(CFLAGS) $(INCFLAGS) $^ $(LIBS) -o $@
1421

15-
wish: $(SRC)
16-
$(CC) -g -o $(BDIR)/$@ $^ $(CFLAGS) $(LIBS)
22+
$(OBJDIR)/%.o: $(SRCDIR)/%.c
23+
mkdir -p $(OBJDIR)
24+
$(CC) -g $(CFLAGS) $(INCFLAGS) -c $^ -o $@
25+
26+
clean:
27+
rm bin/* obj/*
1728

0 commit comments

Comments
 (0)