Skip to content

Commit

Permalink
Added new 'asm' target to makelib.gen and makefile.gen.
Browse files Browse the repository at this point in the history
This new target can be used to generate .lst files containing assembly listing of compiled C files.
  • Loading branch information
Stephane-D committed Feb 13, 2018
1 parent 1b6425c commit 954615d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 15 deletions.
26 changes: 20 additions & 6 deletions makefile.gen
Expand Up @@ -45,50 +45,61 @@ OBJ+= $(SRC_S80:.s80=.o)
OBJ+= $(SRC_ASM:.asm=.o)
OBJ+= $(SRC_S:.s=.o)
OBJ+= $(SRC_C:.c=.o)

OBJS= $(addprefix out/, $(OBJ))

LST= $(SRC_C:.c=.lst)
LSTS= $(addprefix out/, $(LST))

INCS= -I$(INCLUDE) -I$(SRC) -I$(RES) -I$(LIBINCLUDE) -I$(LIBRES)
DEFAULT_FLAGS= -m68000 -Wall -fno-builtin $(INCS) -B$(BIN)
FLAGSZ80= -i$(SRC) -i$(INCLUDE) -i$(RES) -i$(LIBSRC) -i$(LIBINCLUDE)


release: FLAGS= $(DEFAULT_FLAGS) -O3 -flto -fuse-linker-plugin -fno-web -fno-gcse -fno-unit-at-a-time -fomit-frame-pointer
#release: FLAGS= $(DEFAULT_FLAGS) -O3 -S -fuse-linker-plugin -fno-web -fno-gcse -fno-unit-at-a-time -fomit-frame-pointer
#release: FLAGS= $(DEFAULT_FLAGS) -O1 -fomit-frame-pointer
release: FLAGS= $(DEFAULT_FLAGS) -O3 -fuse-linker-plugin -fno-web -fno-gcse -fno-unit-at-a-time -fomit-frame-pointer -flto
release: LIBMD= $(LIB)/libmd.a
release: pre-build out/rom.bin

debug: FLAGS= $(DEFAULT_FLAGS) -O1 -ggdb -DDEBUG=1
debug: LIBMD= $(LIB)/libmd_debug.a
debug: pre-build out/rom.bin out/rom.out out/symbol.txt

asm: FLAGS= $(DEFAULT_FLAGS) -O3 -fuse-linker-plugin -fno-web -fno-gcse -fno-unit-at-a-time -fomit-frame-pointer -S
asm: pre-build $(LSTS)


all: release
default: release

Default: release
Debug: debug
Release: release
Asm: asm

.PHONY: clean

cleanlst:
$(RM) -f $(LSTS)

cleanobj:
$(RM) -f $(OBJS) out/sega.o out/rom_head.bin out/rom_head.o out/rom.out

clean: cleanobj
clean: cleanobj cleanlst
$(RM) -f out.lst out/cmd_ out/rom.nm out/rom.wch out/rom.bin

cleanrelease: clean

cleandebug: clean
$(RM) -f out/symbol.txt
$(RM) -f out/symbol.txt

cleanasm: cleanlst

cleandefault: clean
cleanDefault: clean

cleanRelease: cleanrelease
cleanDebug: cleandebug

cleanAsm: cleanasm

pre-build:
$(MKDIR) -p $(SRC)/boot
Expand Down Expand Up @@ -127,6 +138,9 @@ $(SRC)/boot/rom_head.c: $(LIBSRC)/boot/rom_head.c
$(CP) $< $@


out/%.lst: %.c
$(CC) $(FLAGS) -c $< -o $@

out/%.o: %.c
$(CC) $(FLAGS) -c $< -o $@

Expand Down
33 changes: 24 additions & 9 deletions makelib.gen
Expand Up @@ -29,48 +29,60 @@ OBJ_LIB+= $(SRC_LIB_S80:.s80=.o)
OBJ_LIB+= $(SRC_LIB_S:.s=.o)
OBJ_LIB+= $(SRC_LIB_C:.c=.o)

LST_LIB= $(SRC_LIB_C:.c=.lst)

INCS_LIB= -I$(INCLUDE_LIB) -I$(SRC_LIB) -I$(RES_LIB)
DEFAULT_FLAGS_LIB= -m68000 -Wall -fno-builtin $(INCS_LIB) -B$(BIN)
FLAGSZ80_LIB= -i$(SRC_LIB) -i$(INCLUDE_LIB)


release: FLAGS_LIB= $(DEFAULT_FLAGS_LIB) -O3 -flto -fuse-linker-plugin -fno-web -fno-gcse -fno-unit-at-a-time -fomit-frame-pointer
#release: FLAGS_LIB= $(DEFAULT_FLAGS_LIB) -S -O3 -fuse-linker-plugin -fno-web -fno-gcse -fno-unit-at-a-time -fomit-frame-pointer
#release: FLAGS_LIB= $(DEFAULT_FLAGS_LIB) -O1 -fomit-frame-pointer
release: FLAGS_LIB= $(DEFAULT_FLAGS_LIB) -O3 -fuse-linker-plugin -fno-web -fno-gcse -fno-unit-at-a-time -fomit-frame-pointer -flto
release: $(LIB)/libmd.a

debug: FLAGS_LIB= $(DEFAULT_FLAGS_LIB) -O1 -ggdb -DDEBUG=1
debug: $(LIB)/libmd_debug.a

asm: FLAGS_LIB= $(DEFAULT_FLAGS_LIB) -O3 -fuse-linker-plugin -fno-web -fno-gcse -fno-unit-at-a-time -fomit-frame-pointer -S
asm: $(LST_LIB)


all: release
default: release

Default: release
Debug: debug
Release: release
Asm: asm

.PHONY: clean


cleanlst:
$(RM) -f $(LST_LIB)

cleanobj:
$(RM) -f $(OBJ_LIB)

cleanrelease: cleanobj
cleanrelease: cleanobj cleanlst
$(RM) -f $(LIB)/libmd.a out.lst cmd_

cleandebug: cleanobj
cleandebug: cleanobj cleanlst
$(RM) -f $(LIB)/libmd_debug.a out.lst cmd_

clean: cleanobj
cleanasm: cleanlst

clean: cleanobj cleanlst
$(RM) -f $(LIB)/libmd.a $(LIB)/libmd_debug.a out.lst cmd_

cleanall: cleanrelease
cleanAll: cleanrelease
cleandefault: cleanrelease
cleanDefault: cleanrelease
cleanall: clean
cleanAll: clean
cleandefault: clean
cleanDefault: clean

cleanRelease: cleanrelease
cleanDebug: cleandebug
cleanAsm: cleanasm


$(LIB)/libmd.a: cmd_
Expand All @@ -85,6 +97,9 @@ cmd_ : $(OBJ_LIB)
$(ECHO) "$(OBJ_LIB)" > cmd_


%.lst: %.c
$(CC) $(FLAGS_LIB) -c $< -o $@

%.o: %.c
$(CC) $(FLAGS_LIB) -c $< -o $@

Expand Down

0 comments on commit 954615d

Please sign in to comment.