Skip to content

Commit

Permalink
Simplified directory creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mike632t committed Mar 10, 2024
1 parent a2b9161 commit 25f88c9
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@
# - Create TARGET directory if it doesn't exist - MT
# - Fixed error in directory path when TARGET is defined
# on the command line - MT
# - Simplified directory creation - MT
#

PROGRAM = x11-calc
PROGRAM = x11-calc

TARGET := ./bin
SRC := ./src
PRG := ./prg
ROM := ./rom
IMG := ./img
TARGET := ./bin
SRC := ./src
PRG := ./prg
ROM := ./rom
IMG := ./img

SOURCES = $(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.h)
SOURCES += $(wildcard make.sh*) $(wildcard make.com*) $(wildcard makefile*) $(wildcard $(SRC)/makefile*)
Expand Down Expand Up @@ -93,26 +94,20 @@ spice: clean $(SPICE) $(OTHERS)
voyager: clean $(VOYAGER) $(OTHERS)

define prog_template =
hp$(1): $(1)
$(1): $(SOURCES)
hp$(1): $(1) $(TARGET)
$(1): $(SOURCES) $(TARGET)
@$$(MAKE) MODEL=$(1) TARGET=../$(TARGET)
endef

$(foreach calc,$(ALL),$(eval $(call prog_template,$(calc))))

launcher: $(SRC)/x11-calc.in
ifeq ($(wildcard $(TARGET)/.),)
@mkdir -p $(TARGET)
endif
launcher: $(SRC)/x11-calc.in $(TARGET)
# @install -m755 $(SRC)/x11-calc.in $(TARGET)/x11-calc.sh
@cp $(SRC)/x11-calc.in $(TARGET)/x11-calc.sh
@chmod +x $(TARGET)/x11-calc.sh
( cd $(TARGET) && ls --color x11-calc.sh )

desktop: $(SRC)/x11-calc.desktop
ifeq ($(wildcard $(TARGET)/.),)
@mkdir -p $(TARGET)
endif
desktop: $(SRC)/x11-calc.desktop $(TARGET)
# @install -m644 $(SRC)/x11-calc.desktop $(TARGET)
@cp $(SRC)/x11-calc.desktop $(TARGET)
@chmod +x $(TARGET)/x11-calc.desktop
Expand All @@ -122,6 +117,9 @@ endif
done
( cd $(TARGET) && ls --color x11-calc.desktop )

$(TARGET):
@mkdir -p $(TARGET)

clean:
@rm -f $(SRC)/*.o $(TARGET)/x11-calc.desktop*
@test -d $(TARGET) && (cd $(TARGET) && rm -f *) || true
Expand Down

0 comments on commit 25f88c9

Please sign in to comment.