Skip to content

Commit

Permalink
Merge pull request #2028 from ghaerr/make
Browse files Browse the repository at this point in the history
[build] Cleanup Makefiles, add RM, remove Make.rules
  • Loading branch information
ghaerr authored Sep 20, 2024
2 parents 9af6226 + 4704436 commit a6ba583
Show file tree
Hide file tree
Showing 55 changed files with 145 additions and 331 deletions.
2 changes: 1 addition & 1 deletion elks/Makefile-rules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
########################################################################
# #
# Standard rulesets for use when compiling and installing this system. #
# Standard rulesets for use when compiling the ELKS kernel. #
# #
########################################################################

Expand Down
2 changes: 1 addition & 1 deletion elkscmd/Applications
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ sys_utils/kill :sysutil :360c :720k
sys_utils/ps :sash :sysutil :360k :128k :nocomp
sys_utils/ps :::uptime :sysutil :128k :1440k
sys_utils/makeboot :sysutil :360k
sys_utils/man :sysutil :1200k
sys_utils/man :sysutil
sys_utils/meminfo :sash :sysutil :360k :128k
sys_utils/mouse :sysutil :1200c :1440k
sys_utils/passwd :sysutil :1200k
Expand Down
3 changes: 0 additions & 3 deletions elkscmd/Make.rules

This file was deleted.

4 changes: 1 addition & 3 deletions elkscmd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

BASEDIR = .

include $(BASEDIR)/Make.defs
include $(BASEDIR)/Makefile-rules

###############################################################################
#
Expand Down Expand Up @@ -47,8 +47,6 @@ SUBDIRS = \
#
# Compile everything.

include $(BASEDIR)/Make.rules

all:
@if [ ! -e $(TOPDIR)/include/autoconf.h ]; \
then echo -e "\n*** ERROR: You must configure ELKS first ***\n" >&2; exit 1; fi
Expand Down
47 changes: 16 additions & 31 deletions elkscmd/Make.defs → elkscmd/Makefile-rules
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
# ***** IMPORTANT NOTE *****
#
# This file has been revised to remove the requirement that the elkscmd
# and elks trees are located under /usr/src on the developer's system.
# This requires that the variable BASEDIR be defined in every Makefile
# that includes this header file, prior to including it, and the value
# given to BASEDIR is required to be the relative path from the directory
# containing that Makefile to the directory containing this file.
#
# In addition, if there are any local definitions that need including in
# the CFLAGS value, those should be assigned to LOCALFLAGS before including
# this file.
#
# So as to ensure this, it is recommended that the following three lines
# be used as the first three lines of each Makefile including this file:
#
# BASEDIR = ...
#
# LOCALFLAGS = ...
#
# include $(BASEDIR)/Make.defs
#
# This ensures that the correct value is assigned by using it to include
# this file.
#
##############################################################################
# #
# Standard rulesets for use when compiling ELKS applications. #
# #
# This file should be included in every Makefile below elkscmd/ via e.g.: #
# BASEDIR=.. #
# include $(BASEDIR)/Makefile-rules #
# #
##############################################################################

ifndef TOPDIR
Expand All @@ -42,11 +25,6 @@ ELKSCMD_DIR=$(TOPDIR)/elkscmd

INCLUDES=-I$(TOPDIR)/include -I$(TOPDIR)/libc/include -I$(ELKS_DIR)/include

# temporarily turn off typical non-K&R warnings for now
WARNINGS = -Wno-implicit-int
# temporarily turn off suggesting parenthesis around assignment used as truth value
WARNINGS += -Wno-parentheses

##############################################################################
#
# Determine the ELKS kernel version.
Expand Down Expand Up @@ -77,6 +55,11 @@ ifeq ($(CONFIG_APPS_FTRACE), y)
CLBASE += -finstrument-functions-simple -maout-symtab
endif

# temporarily turn off typical non-K&R warnings for now
WARNINGS = -Wno-implicit-int
# temporarily turn off suggesting parenthesis around assignment used as truth value
WARNINGS += -Wno-parentheses

CC=ia16-elf-gcc
AS=ia16-elf-as
LD=ia16-elf-gcc
Expand All @@ -96,13 +79,15 @@ TINYPRINTF=$(ELKSCMD_DIR)/lib/tiny_vfprintf.o
#
# Standard compilation rules.

.PHONY: all clean install

.S.s:
$(CC) -E -traditional $(INCLUDES) $(CCDEFS) -o $*.s $<

.S.o:
$(CC) -E -traditional $(INCLUDES) $(CCDEFS) -o $*.tmp $<
$(AS) $(ASFLAGS) -o $*.o $*.tmp
rm -f $*.tmp
$(RM) $*.tmp

.s.o:
$(AS) $(ASFLAGS) -o $*.o $<
Expand Down
8 changes: 2 additions & 6 deletions elkscmd/advent/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
BASEDIR=..

include $(BASEDIR)/Make.defs
include $(BASEDIR)/Makefile-rules

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules

CFLAGS += -DELKS=1
#CFLAGS += -Wno-parentheses
Expand Down Expand Up @@ -43,4 +39,4 @@ install: $(PRGS)
$(INSTALL) advent.db $(DESTDIR)/lib

clean:
rm -f $(PRGS) $(HOSTPRGS) *.o *.map
$(RM) $(PRGS) $(HOSTPRGS) *.o *.map
12 changes: 4 additions & 8 deletions elkscmd/ash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@

BASEDIR = ..

include $(BASEDIR)/Make.defs

LOCALFLAGS = -DSHELL -I. -D_MINIX -D_POSIX_SOURCE -Dlint
LOCALFLAGS += -Wno-implicit-int
include $(BASEDIR)/Makefile-rules

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules
LOCALFLAGS = -DSHELL -I. -D_MINIX -D_POSIX_SOURCE -Dlint
LOCALFLAGS += -Wno-implicit-int

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

Expand Down Expand Up @@ -57,7 +53,7 @@ install: ash
$(INSTALL) ash $(DESTDIR)/bin/sh

clean:
rm -f core ash $(CLEANFILES)
$(RM) ash $(CLEANFILES)

parser.o: token.def

Expand Down
8 changes: 2 additions & 6 deletions elkscmd/basic/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
BASEDIR=..

include $(BASEDIR)/Make.defs
include $(BASEDIR)/Makefile-rules

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules

CFLAGS += -Wno-maybe-uninitialized

Expand Down Expand Up @@ -55,4 +51,4 @@ install: $(PRGS)
$(INSTALL) $(PRGS) $(DESTDIR)/bin

clean:
rm -f $(PRGS) $(HOSTPRGS) *.o *.map
$(RM) $(PRGS) $(HOSTPRGS) *.o *.map
10 changes: 3 additions & 7 deletions elkscmd/bc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
#
# A makefile for bc. This is part of the bc/sbc distribution.
#
# $Id$
###############################################################################
#
# Include standard packaging commands.

BASEDIR = ..
include $(BASEDIR)/Make.defs
include $(BASEDIR)/Makefile-rules

###############################################################################
#
Expand Down Expand Up @@ -52,7 +48,7 @@ math.h: libmath.b
$(MAKE) -$(MAKEFLAGS) fbc
elksemu ./fbc -c libmath.b </dev/null >math.h
./fix_math.h
rm -f ./fbc
$(RM) ./fbc

fbc: $(OFILES) bc.o
echo \"\" > math.h
Expand All @@ -64,7 +60,7 @@ install: bc fbc
# $(INSTALL) fbc $(DESTDIR)/bin

clean:
rm -f *.o *.bak core math.h bc fbc sbc bc.c sbc.c scan.c y.tab.h
$(RM) *.o *.bak math.h bc fbc sbc bc.c sbc.c scan.c y.tab.h

scan.c: scan.l
$(LEX) scan.l
Expand Down
3 changes: 1 addition & 2 deletions elkscmd/busyelks/makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
BASEDIR = ..
include $(BASEDIR)/Make.defs
include $(BASEDIR)/Make.rules
include $(BASEDIR)/Makefile-rules

# Install destination
DESTDIR=$(TOPDIR)/target
Expand Down
12 changes: 3 additions & 9 deletions elkscmd/cron/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
##################################################################################

# Makefile for cron

BASEDIR=..

include $(BASEDIR)/Make.defs

LOCALFLAGS = -Wno-implicit-int -Wno-return-type $(OPTIONS)
include $(BASEDIR)/Makefile-rules

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules
LOCALFLAGS = -Wno-implicit-int -Wno-return-type $(OPTIONS)

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

Expand All @@ -31,7 +25,7 @@ crontab: crontab.o $(common)
$(CC) $(CFLAGS) -maout-heap=14336 -o $@ crontab.o $(common)

clean:
rm -f $(progs) *.o
$(RM) $(progs) *.o

install: cron
$(INSTALL) cron $(DESTDIR)/bin/cron
Expand Down
16 changes: 6 additions & 10 deletions elkscmd/debug/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
BASEDIR=..

include $(BASEDIR)/Make.defs
include $(BASEDIR)/Makefile-rules

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules

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

PRGS = testsym disasm nm opcodes

# disable tail call optimization for better stack traces
CFLAGS += -fno-optimize-sibling-calls
Expand All @@ -24,6 +16,10 @@ LDFLAGS += -maout-symtab
# added after CFLAGS for non-instrumented .c files in this directory
#NOINSTFLAGS = -fno-instrument-functions -fno-instrument-functions-simple

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

PRGS = testsym disasm nm opcodes

HOSTPRGS = nm86 hostdisasm
HOSTCFLAGS += -I. -I$(TOPDIR)/elks/include
SYMS_C = $(TOPDIR)/libc/debug/syms.c
Expand Down Expand Up @@ -68,4 +64,4 @@ install: $(PRGS)
$(INSTALL) $(PRGS) $(DESTDIR)/bin

clean:
rm -f $(PRGS) $(HOSTPRGS) *.o *.map system.sym
$(RM) $(PRGS) $(HOSTPRGS) *.o *.map system.sym
8 changes: 2 additions & 6 deletions elkscmd/disk_utils/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
BASEDIR=..

include $(BASEDIR)/Make.defs
include $(BASEDIR)/Makefile-rules

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules

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

Expand Down Expand Up @@ -39,4 +35,4 @@ ramdisk: ramdisk.o
$(LD) $(LDFLAGS) -o ramdisk ramdisk.o $(LDLIBS)

clean:
rm -f *.o $(PRGS)
$(RM) *.o $(PRGS)
6 changes: 3 additions & 3 deletions elkscmd/elvis/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# combined Makefile for ELVIS - a clone of `vi`
#
###############################################################################

BASEDIR = ..
include $(BASEDIR)/Makefile-rules

include $(BASEDIR)/Make.defs
###############################################################################

LOCALFLAGS=-DM_SYSV -DCRUNCH -DNO_MKEXRC -DNO_CURSORSHAPE -DNO_CHARATTR \
-DNO_SHOWMODE -DNO_MODELINE -DNO_OPTCOLS -DNO_DIGRAPH -DNO_ABBR \
Expand Down Expand Up @@ -377,7 +377,7 @@ inst.os9: $(DUMMY)

##############################################################################
clean: $(DUMMY)
$(RM) *.o $(DOC)*.1 elvis?.uue elvis?.sh core elvis ctags ref virec refont
$(RM) *.o $(DOC)*.1 elvis?.uue elvis?.sh elvis ctags ref virec refont


clobber: clean
Expand Down
8 changes: 2 additions & 6 deletions elkscmd/file_utils/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
BASEDIR=..

include $(BASEDIR)/Make.defs
include $(BASEDIR)/Makefile-rules

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules

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

Expand Down Expand Up @@ -87,4 +83,4 @@ install: $(PRGS)
$(INSTALL) $(PRGS) $(DESTDIR)/bin

clean:
rm -f $(PRGS) *.o
$(RM) $(PRGS) *.o
12 changes: 4 additions & 8 deletions elkscmd/fsck_dos/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
BASEDIR=..

include $(BASEDIR)/Make.defs

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules
include $(BASEDIR)/Makefile-rules

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

LOCALCFLAGS = -Dlint -DELKS=1
# remove next line when FAT32 supported
LOCALCFLAGS += -Wno-shift-count-overflow

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

PRGS = fsck-dos

all: $(PRGS)
Expand All @@ -40,4 +36,4 @@ fsck-dos: main.o boot.o check.o dir.o fat.o
$(LD) $(LDFLAGS) -maout-heap=0xffff -o $@ $^ $(LDLIBS)

clean:
rm -f *.o $(PRGS)
$(RM) *.o $(PRGS)
6 changes: 1 addition & 5 deletions elkscmd/inet/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
BASEDIR=..

include $(BASEDIR)/Make.defs
include $(BASEDIR)/Makefile-rules

###############################################################################
#
# Include standard packaging commands.

include $(BASEDIR)/Make.rules

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

Expand Down
Loading

0 comments on commit a6ba583

Please sign in to comment.