Skip to content

Commit

Permalink
Improve 'xl add' with a check on the present of the target
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrizio-Caruso committed Aug 20, 2022
1 parent 2365d00 commit 5bb6532
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/makefiles.common/targets/Makefile_eg2k
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


##############################################################################

eg2k: $(ASSETS_PATH)/z88dk_xchase.asm
Expand All @@ -7,6 +8,7 @@ eg2k: $(ASSETS_PATH)/z88dk_xchase.asm
-D__EG2K__ \
-subtype=eg2000disk \
-pragma-redirect:getk=getk_inkey \
-D_XL_SLOW_DOWN_FACTOR=$(_COMMON_SLOWDOWN_FACTOR)*$(_EG2K_SLOWDOWN) \
$(INCLUDE_OPTS) -DFORCE_BIT_BANG \
-D__EG2K__ \
-DFULL_GAME \
Expand All @@ -20,10 +22,8 @@ eg2k: $(ASSETS_PATH)/z88dk_xchase.asm
-clib=default -pragma-redirect:fputc_cons=fputc_cons_generic \
$(CROSS_LIB_PATH)/display/init_graphics/z88dk/udg/udg_init_graphics.c \
$(ASSETS_PATH)/z88dk_xchase.asm \
$(SOURCE_PATH)/end_screen.c \
$(FULL_FILES) \
$(CROSS_LIB_PATH)/sound/z88dk/psg/ay-3-8910_psg_sounds.c \
-create-app -o$(BUILD_PATH)/X$(GAME_NAME)_eg2k.bin
rm -rf $(BUILD_PATH)/X$(GAME_NAME)_eg2k.bin


22 changes: 22 additions & 0 deletions src/makefiles.common/targets/Makefile_einstein
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@


##############################################################################


einstein: $(ASSETS_PATH)/z88dk_xchase.asm
$(Z88DK_PATH)$(MYZ88DK) +cpm $(SCCZ80_OPTS) -subtype=einstein -leinstein \
-pragma-define:ansicolumns=32 \
$(INCLUDE_OPTS) \
-D__EINSTEIN__ \
-DFORCE_CONIO_LIB \
-D_XL_SLOW_DOWN_FACTOR=$(_COMMON_SLOWDOWN_FACTOR)*$(_EINSTEIN_SLOWDOWN) \
-DFULL_GAME -DLESS_TEXT \
-clib=ansi \
-DCONIO -DUDG_GRAPHICS \
-create-app -o$(BUILD_PATH)/X$(GAME_NAME)_einstein.bin \
$(ASSETS_PATH)/z88dk_xchase.asm \
$(CROSS_LIB_PATH)/display/init_graphics/z88dk/udg/udg_init_graphics.c \
$(FULL_FILES)
rm -rf $(BUILD_PATH)/X$(GAME_NAME)_einstein.bin


19 changes: 17 additions & 2 deletions src/xl
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,17 @@ def add(params):
else:
print("target not found")
exit()

project_path = "projects/" + project

full_project_path = project_path + "/Makefile." + project

with open(full_project_path) as file:
project_makefile_content = file.read()

if(target+":" in project_makefile_content):
print("Target already present. First delete it from " + full_project_path)
exit()

full_new_target_path = new_target_path + new_Makefile

Expand All @@ -905,9 +916,8 @@ def add(params):
run_command_verbosely(command_string)
print("\n")

project_path = "projects/" + project

full_project_path = project_path + "/Makefile." + project


command_string = "cat " + full_new_target_path + " >> " + full_project_path
run_command_verbosely(command_string)
Expand All @@ -924,6 +934,11 @@ def help(params):
print("")
print("It adds support for the new target <target> into <project> by modifying its Makefile.")
print("")
print("Example:")
print("If you have previously created a new project 'foo'")
print("(e.g., by cloning it with 'xl clone bomber foo'),")
print("then you can add support for the 'einstein' target to it with")
print("xl add foo einstein")
elif params[1]=="tools":
print("\nxl tools")
print("\n(or xl build tools)")
Expand Down

0 comments on commit 5bb6532

Please sign in to comment.