Skip to content

Commit

Permalink
Fixed makefile
Browse files Browse the repository at this point in the history
Fixed the ugly `debug` target that was overwritten with debugger options with the `-g` c flag
  • Loading branch information
cheng-alvin committed Nov 2, 2023
1 parent 5c7de53 commit 43572ed
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ CC = clang
LD = clang
DB = lldb

CFLAGS = -I ../include -g
CFLAGS_COMMON = -I ../include -Wall -Wextra
CFLAGS = $(CFLAGS_COMMON)

OBJ = main.o parse.o endian.o write.o
BUILD = ../build

all: clean jas
all: clean jas debug

jas: CFLAGS = $(CFLAGS_COMMON)
jas: $(OBJ)
$(LD) $^ -o $(BUILD)/$@

# TODO: fix this ugly hack!
debug: clean jas $(OBJ)
$(DB) $(BUILD)/jas
debug: CFLAGS = $(CFLAGS_COMMON) -g
debug: clean $(OBJ)
$(LD) $(wordlist 2,$(words $^),$^) -o $(BUILD)/$@
$(DB) $(BUILD)/debug

clean:
rm -r -f *.o $(BUILD)
mkdir -p $(BUILD)
mkdir -p $(BUILD)

0 comments on commit 43572ed

Please sign in to comment.